age_of_me = 17 count = 0 while count < 5: guess_age = int(input("guess age:")) if guess_age == age_of_me : print("yes,you get it.") break elif guess_age > age_of_me: print("guess smaller") else: print("guess bigger") count +=1 if count == 5: countine_confirm = input("do you want go on:") if countine_confirm != ‘n‘: count = 0
原文:https://www.cnblogs.com/0815tang/p/10884304.html