Huang_age = 20

a = 0

while True:
    if a <=2:
        user_guess = int(input("your guess:\n"))
        if user_guess == Huang_age:
            print("恭喜你猜对了!")
            break
        elif user_guess < Huang_age:
            print("你猜小了!")
            a +=1
        else:
            print("你猜大了!")
            a +=1
    elif a == 3:
        res = input("还要不要继续:\ny - 继续 q - 退出\n")
        if res.lower() == 'y':
            a = 0
            continue
        elif res.lower() == 'q':
            break
    else:
        break

相关文章:

  • 2022-12-23
  • 2022-01-15
  • 2021-11-05
  • 2021-10-04
  • 2021-12-26
  • 2022-12-23
  • 2022-01-14
猜你喜欢
  • 2021-10-19
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-01-28
  • 2022-01-22
  • 2021-12-30
相关资源
相似解决方案