python之路-day1-while循环

while Thue: (条件为真无限循环)  break(跳出循环)

猜年龄:

#Author:zww
age_of_jay = 40
count = 0
while count < 3:
guess_age = int(input("guess_age:"))
if guess_age > age_of_jay:
print("think smaller...")
elif guess_age < age_of_jay:
print("think bigger...")
else:
print("yes,you got it!")
break
count +=1
if count == 3:
conutine_confirm = input("do you want to keep guessing...?")
if conutine_confirm != "n":
count = 0
else:
print("you have tried too many times...fuck off")

 

posted @ 2017-04-22 11:27  z寒江雪  阅读(271)  评论(0编辑  收藏  举报