‘‘‘
while Ture: 条件成立一直循环
count = 0 初始化计数器
while 条件循环
需要执行的代码
else:
‘‘‘
age_oldboy = 56
count=0
while count < 3:
age_guess = int(input("age_guess:"))
if age_guess == age_oldboy:
print("You got it")
break
elif age_guess > age_oldboy:
print("You guess bigger")
else:
print("You gusess smaller")
count += 1
if count ==3:
countine_sure = input("DO YOU WANT TO KEEP GUESSING...?")
if countine_sure != "a":
count = 0
原文:https://www.cnblogs.com/xiaoyaogege666/p/14167850.html