dimanche 29 novembre 2015

if statement always returns true (Python 3.5) [duplicate]

This question already has an answer here:

I'm very new to Python (have not even finished the codecademy course) but I'm trying to write my first simple program. My if statement always returns true, no matter what the answer is. The indents look right, and I don't have a condition for the else, just a call to print.

answer = input("What is your favorite eldest child's name?   ")

if answer == "A" or "Al":
    print("Of course, we all knew that")
elif answer == "C" or "Chris":
    print("""Oh she must be standing right there.
But that\'s not it, try again.""")
elif answer == "E" or "Ed":
    print("Not even the right gender. Try again.")
else:
    print("I'm sorry. Only children. Were you thinking of the dogs?")

Aucun commentaire:

Enregistrer un commentaire