码迷,mamicode.com
首页 > 编程语言 > 详细

python 用while 猜年龄

时间:2018-06-19 11:42:20      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:python   inpu   print   class   IV   end   pre   break   att   

age = 50

while True:
    user_input_age = int(input("age is: "))
    if user_input_age == age:
            print(" Yes! \n")
            break  #终止
    elif user_input_age > age:
            print("age is smaller, try input batter!")
    else:
            print("age is batter, try input smaller!")
        
print("End!")

 

python 用while 猜年龄

标签:python   inpu   print   class   IV   end   pre   break   att   

原文地址:https://www.cnblogs.com/mouni-11498/p/9197544.html

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