Conditional logic¶
This guide covers how Python makes decisions: if/elif/else, comparison operators, boolean expressions, truthiness, match/case, and guard clauses.
Coming soon
This guide is being migrated and expanded. The current source notebooks and reference pages are being reworked and should land here shortly. In the meantime, the archived version remains available at accuser.dev/conditional-logic-with-python.
What will be here¶
Learn — if/elif/else, comparison and boolean operators, truthiness, match/case, ternary expressions, guard-clause style.
Recipes — combining conditions cleanly, replacing nested ifs with match, short-circuit evaluation tricks.
Reference — operator precedence, truthiness table, match/case pattern syntax.
Concepts — deciding between if-chains and match; why Python treats empty containers as falsy.