我在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