阅读背景:

python基础代码(猜年龄、从最内层跳出多层循环、简单的购物车程序)_diaozang2773的博客

来源:互联网 


1、猜年龄 , 可以让用户最多猜三次!

 

age = 55
i=0
while i<3:
    user_guess = int (input ("input your guess:"))
    if user_guess > age:
        print ("try smaller ")

    elif user_guess < age:
        print ("try bigger")
    else :
        print ("you got it")
        break
    i += 1
age 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: