I am writing a text based adventure game in python language and unfortunately I can't stop the game. I tried writing the code --->
def GAME_RESTART():
i = input("would you like to play again?(y/n)")
if i == "y":
Game()
elif i == "n":
print_pause("YOU'VE COME TO AN END!")
print_pause("Hopefully the game finds you well")
while i != "y" and i != "n":
print_pause("Incorrect input. Please choose (y/n)") *#print_pause is a function I defined already in the rest of the code*
pass
GAME_RESTART()
Any suggestions how to break the code to stop working?
I actually tried using the command break but it did nothing
Restructure the code to make use of the
while
loop. There's no need for the function to call itself.