Guided Notes

Control Flow

Booleans, comparison operators, and/or/not, if/elif/else, and truthiness.

Booleans and comparisons

Slide 1 / 5

The bool type has exactly two values, True and False. You rarely type them — they come from comparisons.

OperatorMeaningExampleResult
a == bequal3 == 3.0True
a != bnot equal'3' != 3True
a < bless than2 < 5True
a > bgreater than2 > 5False
a <= bless than or equal5 <= 5True
a >= bgreater than or equalage >= 18depends
← Numbers & Arithmetic