while循环猜年龄
更新:HHH   时间:2023-1-7


age=53

count=0
while count<3:
ages = int(input("请猜年龄:"))
if ages == age:
print("你猜对了!")
break
elif ages < age:
print("你猜的年龄小了!")
else:
print("你猜的年龄大了!")
count+=1
if count==3:
keep_game=input("if you want keep to guessing(输入n退出游戏,其他则继续玩)...?")
if keep_game!="n":
count=0

返回编程语言教程...