and
KeywordPython 2.0+Beginner
Logical AND operator; returns True if both operands are true
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
Learn by Difficulty
Quick Example
python
x = 10 if x > 0 and x < 100: print(f"{x} is between 0 and 100") name = "Alice" age = 25 if name and age >= 18: print(f"{name} is an adult") # Multiple conditions score = 85 attendance = 90 if score >= 70 and attendance >= 80 and score + attendance > 150: print("Passed the course")
'and' returns True only if both sides are True. It is used to combine multiple conditions that must all hold.
Try in PlaygroundTags
languagesyntaxcorebooleanlogicoperator