Have to make a table that runs functions. I can run the functions once, but after being able to submit for another function the code ends.
def main():
menu()
option=int(input('What option do you choose? '))
if option==1:
rol()
if option==2:
bing()
if option==3:
return
else:
print('Please pick from the menu!')
menu()
option=int(input('What option do you choose? '))
How do I loop it so that after it goes through the options roll() and bingo(), and the menu is shown again, it actually goes through with the functions?
CodePudding user response:
Here is the code so that it will loop forever:
def main():
while True:
print('Please pick an option from the menu!')
menu()
option = int(input('What option do you choose? '))
if option == 3:
return
if option == 1:
roll()
elif option == 2:
bingo()
CodePudding user response:
Assuming your main function works the way it is just once, you can simpy run the loop externally
def main():
# your code ...
if __name__ == "__main__":
while True:
main()