这段代码说的是无效的语法,并指出我的“guessNum”变量。怎么了?

时间:2017-03-20 19:35:19

标签: python-2.7 ipython

from random import randint

myNumber = randint(1000,9999)
guessNum = 0
correctNumbers = 0
Input = False
Userguess = 0

print ("Welcome to Guess The Number")
print ("try to guess my number between 1000 and 9999")

while Input == False:
    Userguess = int(raw_input("Guess a number betweeb 1000 and 9999: ")
    guessNum += 1
    if Userguess == myNumber:
        print("Well Done, you guessed the number in" + str(NumberGuesses) + "guesses")
        Input = True

该程序猜测数字游戏,用户必须猜测10009999之间随机生成的数字。

1 个答案:

答案 0 :(得分:0)

第13行缺少括号。

Userguess = int(raw_input("Guess a number betweeb 1000 and 9999: "))