感谢您阅读本文.我正在尝试从programarcadegames.com做这个实验,你必须在那里写一个测验.我完成了我的第一个问题并得到了语法错误.这是代码:
print ("This is a quiz.")
x=0
questionOne=input("First question! How many fingers does a human have? "
if questionOne == "10" or questionOne.lower() == "ten":
print ("Correct! Good job!")
x+=1
else:
print ("Not quite... try the next one!")
print ("You got the following amount of questions right:",x)
Run Code Online (Sandbox Code Playgroud)
当我去运行它时,我得到一个语法错误,Python shell编辑器窗口突出显示第四行末尾的冒号.删除冒号会使其突出显示下一行的打印.我也试过删除或声明,只是做第四行:
if questionOne == "10":
Run Code Online (Sandbox Code Playgroud)
为了排除故障,但我最终得到了相同的错误和红色冒号.有任何想法吗?批评?嘲笑评论?再次感谢您的阅读.
编辑:
不是那.lowercase()件事,修正了.