or — Easy Examples
Logical OR operator; returns True if at least one operand is true
Logical OR
Using 'or' when at least one condition must be true.
python
day = "Saturday" if day == "Saturday" or day == "Sunday": print("Weekend!") age = 15 if age < 13 or age > 65: print("Discounted ticket") else: print("Regular ticket") # Check multiple possible values color = "red" if color == "red" or color == "blue" or color == "green": print(f"{color} is a primary color")
Expected Output
Weekend! Regular ticket red is a primary color
'or' returns True if at least one side is True. For checking against multiple values, 'in' is often cleaner than chaining 'or'.
Want to try these examples interactively?
Open Easy Playground