vendredi 26 janvier 2018

Using or in if statement (Python) [duplicate]

This question already has an answer here:

I'm just writing a simple if statement. The second line only evaluates to true if the user types "Good!" If "Great!" is typed it'll execute the else statement. Can I not use or like this? Do I need logical or?

    weather = input("How's the weather? ")
if weather == "Good!" or "Great!": 
    print("Glad to hear!")
else: 
    print("That's too bad!")

Aucun commentaire:

Enregistrer un commentaire