Guided Notes
Control Flow
Booleans, comparison operators, and/or/not, if/elif/else, and truthiness.
Booleans and comparisons
Slide 1 / 5The bool type has exactly two values, True and False. You rarely type them ā they come from comparisons.
| Operator | Meaning | Example | Result |
|---|---|---|---|
| a == b | equal | 3 == 3.0 | True |
| a != b | not equal | '3' != 3 | True |
| a < b | less than | 2 < 5 | True |
| a > b | greater than | 2 > 5 | False |
| a <= b | less than or equal | 5 <= 5 | True |
| a >= b | greater than or equal | age >= 18 | depends |
