次のコードがあります。
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文で止めて、ブロック内で実行して止めるべきじゃないの?