Lesson 148: Scope, locals, and shadowing pitfalls
Focus
Treat the excerpt as executable notes: Basic drills Scope, locals, and shadowing pitfalls; spin token 1231740 makes this page unlike its neighbours.
Key ideas
- Angle
Basic: micro cadence8mixesScope, locals, and shadowing pitfalls; spin69698. - Ritual: Add one doctest-style assertion comment above hottest print.
- Guardrail: name the surprise that triggered when literals shifted.
Example (LESSON_UID = "basic-148")
# Basic drill L148 topic-14 micro-7 pattern-4
LESSON_UID = "basic-148"
spin_a, spin_b, spin_c = 501, 248, 76
score = 167
ladder = []
ladder.append("bronze" if score < (spin_a % 41 + 7) else "silver-ish")
ladder.append("gold" if score > (spin_b % 71 + 14) else "retry")
print(sorted(set(ladder)), score)
Practice
Practice 30: Rename locals for domain vocabulary-only; keep behaviour identical. Literal nudge 30.
Fingerprints
- lesson_uid:
basic-148 - umbrella band:
Scope, locals, and shadowing pitfalls(8/10) - lesson_index:
4754