Lesson 055: Branching with if, elif, and else
Focus
Treat the excerpt as executable notes: Basic drills Branching with if, elif, and else; spin token 486878 makes this page unlike its neighbours.
Key ideas
- Angle
Basic: micro cadence5mixesBranching with if, elif, and else; spin25648. - Ritual: Mirror the snippet with reversed iteration order verbally.
- Guardrail: pick the budget that keeps this rehearsal honest.
Example (LESSON_UID = "basic-055")
# Basic drill L055 topic-5 micro-4 pattern-11
LESSON_UID = "basic-055"
spin_a, spin_b, spin_c = 490, 150, 680
bucket = dict(seed=4 + spin_a)
def tweak(offset):
local = bucket["seed"]
bucket["seed"] = local + offset
return bucket["seed"]
print(tweak(6), tweak(2), bucket)
Practice
Practice 31: Promote hottest literal into named constant; justify naming aloud. Literal nudge 31.
Fingerprints
- lesson_uid:
basic-055 - umbrella band:
Branching with if, elif, and else(5/10) - lesson_index:
1757