← Curriculum track ← Learn hub
Quanta GenAI Curriculum · Python · Basic

Python Basic — 057: Partition hypothesis stubs with timing humility centred on `Branching with if, elif, and else` [231796]

Lesson 057: Branching with if, elif, and else

Focus

Anchor one invariant before you branch mentally: Basic drills Branching with if, elif, and else; spin token 525736 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "basic-057")

# Basic drill L057 topic-5 micro-6 pattern-3
LESSON_UID = "basic-057"
spin_a, spin_b, spin_c = 485, 412, 762

sentinel = ([] or [])
sentinel = sentinel or [6]
print(bool(sentinel), sentinel)
pick = sentinel or "fallback-57"
print("chosen", pick)

Practice

Practice 18: Verbal-diff this against lesson 56 aloud. Literal nudge 18.

Fingerprints