python 用while 猜年龄

age = 50

while True:
    user_input_age = int(input("age is: "))
    if user_input_age == age:
            print(" Yes! \n")
            break  #终止  退出程序    #continue跳出当次循环   
    elif user_input_age > age:
            print("age is smaller, try input batter!")
    else:
            print("age is batter, try input smaller!")
        
print("End!")

 

posted @ 2018-06-19 10:49  YangM  阅读(304)  评论(0编辑  收藏  举报