Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Function will not loop

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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()
        
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading