[SOLVED] Function will not loop

Issue

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?

Solution

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()
        

Answered By – gerda die gandalfziege

Answer Checked By – David Goodson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *