jeudi 12 mars 2020

Why is this If Elif statement always resulting in the "yes" variable

Basically I made this code to ask a user if they want to play ball:

print("Do you want to play ball?")

answer = input("I will throw the ball and you will catch it! Yes or no?")


if answer == 'yes' or 'Yes': {
    print("Great, lets play!")
}
elif answer == 'No' or 'no': {
    print("owwkayyyy...")
}

However, when it runs, if I say no it still results with the program printing "great, lets play"

I am new to coding and I seriously do not understand why this isnt working.

Aucun commentaire:

Enregistrer un commentaire