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

猜年龄,三次失败退程序

时间:2017-03-31 00:34:23      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:pytho   sam   user   aml   saml   while   got   count   python   

my_age = 30

count = 0
while count < 3:
    user_input = int(input("input your guess number:"))
    if user_input == my_age:
        print("good job,you got it!")
        break
    elif user_input > my_age:
        print("no no no try samller")
    else:
        print("no no no try bigger")
    count += 1
else:
    print("对你无语,拜拜!")

  

猜年龄,三次失败退程序

标签:pytho   sam   user   aml   saml   while   got   count   python   

原文地址:http://www.cnblogs.com/mrpengfei/p/6649163.html

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