This is a text adventure game. The user is faced with the first scenario a(). If they choose 2, the game continues. If they choose 1, they die and are presented with the option to play again. Not sure what I'm doing wrong here.
"""
MAIN LOOP
"""
play_again = "yes"
while play_again == "yes" or play_again == "y":
a() # user makes a choice
choice = choose_ans()
check_ans_a(choice) # intention: if user chooses "1", they die and are asked to play again
if choice == "1": # problem: Unexpected indent. If indent is deleted, b() becomes unreachable
play_again = input('Play again?\n'
'(y)es ')
break
else:
continue
b()
choice = choose_ans()
check_ans_b(choice)
EDIT: The solution, derived from comments below, was simple:
"""
MAIN LOOP
"""
play_again = "yes"
while play_again == "yes" or play_again == "y":
a() # user makes a choice
choice = choose_ans()
check_ans_a(choice)
if choice == "1" # player dies
play_again = input('Play again?\n'
'(y)es ')
continue # restarts loop
b()
choice = choose_ans()
check_ans_b(choice)
b()is unreachable if you delete the indent?else:continuestatement. Thecontinuestatement tells python to ignore everything below and go back to thewhileif?