码迷,mamicode.com
首页 > 其他好文 > 详细

Guess 任意猜

时间:2017-08-03 23:40:39      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:logs   confirm   log   print   bigger   blog   style   tin   keep   

 1 age_of_oldboy = 56
 2 count = 0
 3 while count <3:
 4     guess_age = int(input("guess age:"))
 5     if guess_age == age_of_oldboy:
 6        print ("yes,you got it.")
 7        break
 8     elif guess_age > age_of_oldboy:
 9         print("think smaller...")
10     else:
11         print("think bigger!")
12         count +=1
13     if count == 3:
14         countine_confirm =input("do you want to keep guessing...?")
15         if countine_confirm !="n":
16             count =0

Guess 任意猜

标签:logs   confirm   log   print   bigger   blog   style   tin   keep   

原文地址:http://www.cnblogs.com/aiaiduo/p/7282633.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!