我在Python中一個簡單的遊戲擺弄周圍,因爲這個語法錯誤,它不會運行:Python語法錯誤?
intro = 'Greetings! What\'s your name?'
Hunter = 'Oh, Hey Hunter! Hows life?'
Spencer = 'Go away you stupid piece of crap!!!'
David = 'Hey dad.'
def Questions():
print intro
answer = raw_input("Well?").upper()
if answer == 'Spencer' or answer == 'spencer'
print Spencer
elif answer == 'Hunter' or answer == 'hunter'
print Hunter
elif answer == 'David' or answer == 'david'
print David
else:
print 'Sorry! I don\'t know you!'
Questions()
Questions()
它不會顯示在這個樣本,但因爲它說,蟒蛇將無法運行該有是第10行的語法錯誤(在'spencer'之後)有人請解釋我做錯了什麼?
當編譯器告訴你有在第10行的錯誤,這意味着「繞線10我弄糊塗了的地方。」實際的錯誤很可能在文件中較早。 – 2013-05-11 02:42:23