dimanche 13 novembre 2016

How do i get my if-statements to repeat if the user does not select one of my options

print "\nPlease select the number of the company you would like to examine from the list below."
    companies = "1. Google\n2. Apple\n3. Intel\n4. Microsoft\n5. IBM"
    print companies
    selection = raw_input("Choose a number: ")
    if selection == "1":
        print google,
    elif selection == "2":
        print apple,
    elif selection == "3":
        print intel,
    elif selection == "4":
        print microsoft,
    elif selection == "5":
        print ibm,
    else:
        print "Sorry, please make your selection again."

how do I get my program to repeat itself until the user selects one of my desired if-statements?

Aucun commentaire:

Enregistrer un commentaire