好的,我是 python 2.7.5 的新手,我的代码似乎不起作用。它只是一个基本的随机数猜测“游戏”
from random import randint
number = randint(1,100)
play = input("Hello! Would you like to play (Y/N) ")
if play in('y','Y'):
print("I've chosen a number between 1 and 100.")
guess = int(input("what is my number?")
while(guess != number):
if(guess > number):
print("Too High!")
else:
print("Too Low!")
guess = int(input("Please guess again: "))
print("Correct! You guessed my number!")
if play in('n','N'):
print('Stop wasting my time then!')
我收到一个突出显示的错误,并说它是“无效的语法”,我们将很高兴为您提供帮助