您正在使用
input而不是
raw_inputpython 2,它将输入评估为python代码。
answer = raw_input("What is the name of Dr. Bunsen Honeydew's assistant?")if answer == "Beaker": print("Correct!")input()相当于
eval(raw_input())
- 输入
- raw_input
另外,您正在尝试将“烧杯”转换为整数,这没有多大意义。
您可以这样替换您脑海中的输入
raw_input:
answer = "Beaker"if answer == "Beaker": print("Correct!")和
input:
answer = Beaker # raises NameError, there's no variable named Beakerif answer == "Beaker": print("Correct!")


