I heard that recursions are bad and I am having trouble finding a solution on having code that is pretty much the equivalent of this but once again, with no recursions. Can someone help me come up with code that does the same thing except without any functions calling themselves?
import os
from time import sleep
def cont():
input('- Press enter to continue -\n')
def cls():
os.system('cls')
def intro():
print('Welcome to No Escape')
print('- By Anonymous -')
sleep(2)
cls()
def play():
print('play')
sleep(1)
bool_play = False
menu()
def menu_help():
print('help')
def settings():
print('sett')
possible_menu_answers = ('play', 'help', 'settings', 'quit')
def menu():
bool_play = False
while not bool_play:
cls()
print('Xx No Escape xX\n')
print('.:Play:.')
print('.:Help:.')
print('.:Settings:.')
print('.:Quit:.')
menu_option = input('> ')
if menu_option in possible_menu_answers:
for a in possible_menu_answers:
if menu_option == a:
if possible_menu_answers.index(a) == 0:
cls()
bool_play = True
play()
elif possible_menu_answers.index(a) == 1:
cls()
menu_help()
cont()
break
elif possible_menu_answers.index(a) == 2:
cls()
settings()
cont()
elif possible_menu_answers.index(a) == 3:
quit()
else:
print('Invalid')
sleep(0.5)
#intro()
menu()