1.猜年龄,连续猜三次,猜对了或不想猜了退出,猜错了判断是否继续
a=0 while a<3: age = int(input('请输入年龄:')) if age < 19: print('猜小了,往大了猜') pass elif age > 19: print('猜大了,往小了猜') pass else: print('猜对了') break a+=1 if a==3: word=input('是否继续?') if word=='Y' or word=='y': a=0 pass elif word=='N' or word=='n': print('期待您下次光临') break else: print('好家伙你字母输错了der逼') pass pass pass