我不知道为什么我在'excpet'上出现语法错误。一切似乎都对我很好!这是我的代码:为什么我在'excpet'上得到语法错误?
def length():
gameLength = int(input("How many words do you want to play? You can chose anywhere from 1-40: "))
global gameLength
if gameLength <= 40 and gameLength >= 1:
quit
else:
int(input("Please choose a number between 1 & 40 "))
except ValueError = True:
int(input("Please choose a number between 1 & 40 "))
return gameLength
可能是因为您输入'except'错误? – Li357
我很惊讶,你只会得到一个错误*有*。随着您演示的代码显示出来,您应该首先获得许多其他错误。假设这是Python(不要忘记语言标签!)。 –
另外,在发布有关错误的问题时,请将实际的错误输出复制粘贴到问题中。作为文本,完整,完整且无需编辑。 –