🧩Logical Operator
Also known as Boolean Operator, AND OR NOT
The words and, or and not, which join or flip true and false values.
Think of it like
Think of it like a rule to go out and play. You need your shoes and your coat.
Example
A ride lets people on if height >= 120 and age >= 8. Jack is tall enough but only 7, so the answer is False.
Why it matters
Real rules have more than one part. Logical operators let one if check them all at once.
Definition
Example code
python
>>> age = 15
>>> age >= 13 and age < 18
True
>>> not True
FalseCommon mistake
Key takeaways
- 1And needs both. True only when every side is true.
- 2Or needs one. True when any side is true.
- 3Not flips. It turns true into false.