I wrote this code for a text-based adventure using Python 3.9. It checks the players answers afterward and keeps them from entering anything other than 1,2, or 3. After the player enters 1,2,or 3 then the code cuts off and does not progress to the rooms that I defined. I tried to figure out what's going on by moving things around, but I kept getting errors. Can anyone tell me why it isn't working? If the player enters K instead of the answer choice it prompts them to enter "1, 2 or 3" then once they enter the correct one it ends the program and does not progress them to the other rooms. I wanted to use the check_function to constantly check throughout the adventure if the player is entering 1, 2, or 3.
#KD
#Functions
def start_game():
player_choice=""
player_options = ["1", "2", "3"]
print("Starting dialogue")
player_choice= str(input ("Enter 1, 2, or 3 to continue"))
#print ("You chose:" + player_choice)
if player_choice==player_options [0]:
room01()
elif player_choice==player_options [1]:
room2()
elif player_choice==player_options [2]:
room3()
else:
check_choice(player_choice, player_options)
def check_choice(player_choice,player_options):
while player_choice not in player_options:
print ("---In Start Room")
player_choice= str(input ("Enter 1, 2, or 3 to continue"))
continue
#print()
def room01():
print("Welcome to room 1")
def room2():
print("Welcome to room 2")
def room3():
print("Welcome to room 3")
#main code
start_game()
