我寫了一個腳本與Python 2.7,這是代碼:爲什麼這個python代碼錯了?
name=raw_input("Hi im a PC, who are you?")
print("Hi " + name + " how are you, are you good?")
answer = raw_input("")
if (answer) == yes:
print("That's good to hear")
elif (answer) == no:
print("Oh well")
else:
print("Sorry, you didnt answer the question properly, Please answer with a yes or no")
這是我的錯誤:
Traceback (most recent call last): File "C:/Python27/programs/2", line 4, in if (answer) == yes: NameError: name 'yes' is not defined
謝謝堆!!! – user1135707 2012-01-07 08:09:07