我有以下代码:
def begin_game():
print "You landed on planet and see three rooms."
door = int(raw_input("Pick number of door>>>"))
print "You approach and see that you need to enter password..."
password = raw_input("Enter your surname>>>")
if door == 1:
medical_room()
if door == 2:
library()
if door == 3:
basement()
else:
print "No room exists"
begin_game()
begin_game()
当我输入door
数字时,我完成medical_room
了函数,但随后执行 else 语句并且代码一遍又一遍地重新开始。
我的问题是为什么执行 else 语句?它不应该在 if 语句上停止,在块内执行并停止吗?