or
KeywordPython 2.0+Beginner
Logical OR operator; returns True if at least one operand is true
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
Learn by Difficulty
Quick Example
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")
'or' returns True if at least one side is True. For checking against multiple values, 'in' is often cleaner than chaining 'or'.
Try in PlaygroundTags
languagesyntaxcorebooleanlogicoperator