Guess 任意猜

Posted aiaiduo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Guess 任意猜相关的知识,希望对你有一定的参考价值。

 1 age_of_oldboy = 56
 2 count = 0
 3 while count <3:
 4     guess_age = int(input("guess age:"))
 5     if guess_age == age_of_oldboy:
 6        print ("yes,you got it.")
 7        break
 8     elif guess_age > age_of_oldboy:
 9         print("think smaller...")
10     else:
11         print("think bigger!")
12         count +=1
13     if count == 3:
14         countine_confirm =input("do you want to keep guessing...?")
15         if countine_confirm !="n":
16             count =0

以上是关于Guess 任意猜的主要内容,如果未能解决你的问题,请参考以下文章