小编Bra*_*eod的帖子

我的python代码有什么问题?

我想在python中制作一个猜谜游戏.

from random import randint
print "\nI'm thinking of a number, you have to guess what it is.\n"

num = randint(1,100)
guess = 0

while guess != num:
    guess = raw_input("Guess the number \n")
    if guess < num:
        print "Guess higher next time \n"
    elif guess > num:
        print "Guess lower next time \n"
    elif guess == num:
        print "That's correct \n"
Run Code Online (Sandbox Code Playgroud)

问题是无论我输入什么号码,我每次都会得到"猜数较低的数字".那有什么不对?

python python-2.7

-6
推荐指数
1
解决办法
69
查看次数

标签 统计

python ×1

python-2.7 ×1