我想在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)
问题是无论我输入什么号码,我每次都会得到"猜数较低的数字".那有什么不对?