我一直在使用Python中的Zork风格的命令解析器,并且我遇到了else:语句的问题。我可能会遗漏一些明显的东西(不是一个非常熟练的程序员),但我无法弄清楚为什么这会导致语法错误。以下是有问题的代码:
while 1 == 1:
room_changed = 0
user_input = raw_input('>')
if user_input == "check":
test.Check()
elif user_input == "north":
room = test.North(X, Y, Z)
room_changed = 1
elif user_input == "south":
room = test.South(X, Y, Z)
room_changed = 1
elif user_input == "east":
room = test.East(X, Y, Z)
room_changed = 1
elif user_input == "west":
room = test.West(X, Y, Z)
room_changed = 1
elif user_input == "look":
print(ROOMS[room]['description']
else:
print("I don't understand")
答案 0 :(得分:1)
您在其他
之前缺少)