【发布时间】:2013-04-28 17:37:03
【问题描述】:
那么我在这里做错了什么?
answer = int(input("What is the name of Dr. Bunsen Honeydew's assistant?"))
if answer == ("Beaker"):
print("Correct!")
else:
print("Incorrect! It is Beaker.")
但是,我只得到
Traceback (most recent call last):
File "C:\Users\your pc\Desktop\JQuery\yay.py", line 2, in <module>
answer = int(input("What is the name of Dr. Bunsen Honeydew's assistant?"))
File "<string>", line 1, in <module>
NameError: name 'Beaker' is not defined
【问题讨论】:
-
您正在使用
int并且您期待string?试试这个int("5")和这个int("hello")
标签: python input python-2.7