阅读背景:

Python实践:猜数字小程序Collatz序列

来源:互联网 

猜数字

  • 代码
'''
猜数字小游戏,不断输入你所猜的数(1-100),程序会根据你的输入提醒你进行
适当调整所猜数的大小,直到最后猜出这个随机数
'''
guessNumber = random.randint(1,100)
print("I'm thinking a number between 1 and 100.")

while True:
    print('Take a guess.')

    guess = int(input())

    if guess > guessNumber:
        print("It's too high")
    elif guess < guessNumber:
        print("It's to low")
    else:
        print("Congratulations, you win.")
        break'''
猜数字小游戏,不断输入你所猜的数(1-



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

分享到: