那麼我在這裏做錯了什麼?使用input時NameError()
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」)' – 2013-04-28 17:50:37