我对编程相当陌生,并开始编写基于文本的游戏。意外的Unindent和语法错误
但是,我不断遇到两个错误;意外的Unindent和语法错误。
我使用try
但它告诉我一个语法错误上except
,如果我得到except
后摆脱了整个块的它,然后给我的下一行“意外取消缩进”错误(“左门”后)突出空白空间。
def prompt_chouseroom1():
prompt_2 = raw_input ("You know what to do by now: ")
try:
if prompt_2 == ("Look around the room"):
print ("You see two doors; one on the left, and one on the right. There is also a dead body in the middle of the room")
print promt_chouseroom1()
if prompt_2 == ("Go through left door"):
left_door()
if prompt_2 == ("Go through middle door"):
prinnt ("WHAT?! You walked through the wall!")
middle_door()
if prompt_2 == ("Go through right door"):
right_door()
if prompt_2 == ("Look under the rug"):
print ("Oh my... you... you weren't supposed to find that. Well... looks like you can leave already. You win. Congrats... I guess :(")
win_game()
else:
print ("Try to LOOK AROUNF THE ROOM.... just a hint ;)")
print
prompt_chouseroom1()
except ValueError:
print ("Try to LOOK AROUNF THE ROOM.... just a hint ;)")
print
prompt_chouseroom1()
def left_door():
看看'try'的缩进。看看'except'的缩进。这些线条的缩进是否有任何问题? – user2357112