While循环猜年龄

# -*- coding: utf-8 -*-
# 1ly_age年龄30
# 2、猜对退出
# 3、猜错5次询问:n退出,任意键继续

ly_age=30
count=0
while True:
while count<5:
age=int(input("请输入年龄:"))
if ly_age==age:
print("恭喜回答正确。。。。")
break
elif ly_age>age:
print("小于实际年龄。。。")
elif ly_age<age:
print("大于实际年龄。。。")
count+=1
yon=input("n退出,任意键继续")
if yon!="n":
count=0
else:
break
原文地址:https://www.cnblogs.com/hekaiqiaq/p/8760888.html