dimanche 2 août 2020

Taking the value entered of an input command and putting it in an if statement? [duplicate]

I am trying to take the integer entered as the value entered at an input command and use that answer to execute a quit function further down.

The code is:

print("Enter 1 to enter Airport Details.")
print("Enter 2 to enter Flight Details. ")
print("Enter 3 to enter price plan and calculate Flight Profit.")
print("Enter 4 to Clear entered Data.")
print("Enter 5 to Quit the program.")
num = input("Please enter a number: ")

if num == 5:
    Quit = input("Would you like to quit? (Y/n): ")
    if Quit == "Y":
        yn = input("Are you sure you want to quit (Y/n)")
        if yn == "Y":
            exit()
    else:
        print("Ok then")
else:
    print("Ok then")

Any help would be appreciated, Thanks, Spit.

Aucun commentaire:

Enregistrer un commentaire