Logical Operators
Logical operators combine yes/no answers.
They are like rules for permission slips.
You may need two yes answers. Or only one. Or the opposite.
Python uses and, or, and not.
and needs both
and is True only when both sides are True.
Like needing a ticket and a backpack before a field trip.
or needs one
or is True when at least one side is True.
Like being allowed in if you have a pass or a parent with you.
not flips
not turns True into False and False into True.
Like flipping a switch.
Combining checks
You can build bigger rules from small ones.
Use parentheses when the rule gets long.
and is stricter: both must pass
or is looser: one pass is enough
not reverses a check
parentheses make the order clear
Short-circuit idea
With and, if the left side is False, Python can skip the right side.
With or, if the left side is True, Python can skip the right side.
That saves work and can avoid errors later.
Truth table practice
Try all four pairs for and and or.
Tip: Read and as both, or as either, and not as opposite.
Test yourself
Three quick questions made just for this lesson. Earn 10 XP per correct answer.