# Author:Zhangage_of_oldboy = 56count =0while count<3: #优化三次循环 guess_age = int(input("guess age:")) if guess_age == age_of_oldboy : print("yes,you got it.") break #break 循环结束 elif guess_age > age_of_oldboy: print("think smaller...") else: print("think bigger!") count +=1else: #while循环,否则运行下面代码(三次循环错误往下, # 三次循环正确结束,不往下) print("you have tried too many times..fuck off") #猜年龄大小 if 出错因为py3默认字符串 需要加int()