dimanche 27 janvier 2019

I am having trouble getting my if/else statement to run the else statement

I wrote the below code. Whenever I enter a non-accepted value such as a, b, c, or d, I want the else statement not-nested to be run, but every-time I do, it just runs the Instagram input. I was wondering how I can go about fixing this issue. Thank you.

if commandPrompt.lower() == 'a' or 'b' or 'c' or 'd':
    instagram = input("Will you share this on Instagram? (y/n): ")
    if instagram.lower() == 'y':
        print()
        print("Thanks! You will get 5 knuts off your purchase!")
    else:
        print("Ok. No problem.")
else:
    print("You have entered an invalid selection. Please try again.")

Aucun commentaire:

Enregistrer un commentaire