vendredi 10 août 2018

Python While If Statement not working

def b_class():
    print("--------Business Class--------")
    print("1. Penang to Langkawi")
    print("2. Langkawi to Penang")
    print("R - to return to Purchasing Module")
    print("")
    print("Please select your option: ")
    loop = 0
    while (loop == 0):
        opt4 = str(input())
        if opt4 == "1":
            penang_to_langkawi_b()
        elif opt4 == "2":
            langkawi_to_penang_b()
        elif opt4.lower() == "r":
            sub_menu()
        else:
            print("Please enter a vaild option ")

def penang_to_langkawi_b():
    print("PLease choose a date by inserting a number")
    print("1. 20-08-2018, Monday")
    print("2. 21-08-2018, Tuesday")
    print("3. 22-08-2018, Wednesday")
    print("4. 23-08-2018, Thrusday")
    print("5. 24-08-2018, Friday")
    print("6. 25-08-2018, Saturday")
    print("7. 26-08-2018, Sunday")
    print("")
    print("R - to return the page")
    print("Please select your option: ")
    loop = 0
    while (loop == 0): 
        opt6 = input()
        if opt6.lower() == "1" or "2" or "3" or "4" or "5" or "6" or "7":
            time_1()
        elif opt6 in ["R", "r"]:
            b_class()
        else:
            print("Please enter a vaild option "

I want to return to b_class() if I do not choose any time at penang_to_langkawi_b() but the python is processing me to next page instead of returning to b_class(). Can someone shows me the issues or error I input wrong?

Aucun commentaire:

Enregistrer un commentaire