Lesson 144: Scope, locals, and shadowing pitfalls
Focus
Let the literals expose mistaken assumptions quickly: Basic drills Scope, locals, and shadowing pitfalls; spin token 1222294 makes this page unlike its neighbours.
Key ideas
- Angle
Basic: micro cadence4mixesScope, locals, and shadowing pitfalls; spin48297. - Ritual: Mirror the snippet with reversed iteration order verbally.
- Guardrail: pick the budget that keeps this rehearsal honest.
Example (LESSON_UID = "basic-144")
# Basic drill L144 topic-14 micro-3 pattern-1
LESSON_UID = "basic-144"
spin_a, spin_b, spin_c = 741, 724, 480
left, right = spin_a + 144, spin_b + 3
print(divmod(left + 3, max(3, (spin_c % 9) + 2)))
acc = (310 + 144) % (181 % 881 + 3 + 1)
for step in range(3 + (14 % 4)):
acc = acc * (spin_a % 11 + 3) % 100003
if acc % (spin_b % 8 + 2) == 0:
print("hit", step, acc)
print("trail", acc)
Practice
Practice 32: Shadow one variable purposely to spotlight scope quirks. Literal nudge 32.
Fingerprints
- lesson_uid:
basic-144 - umbrella band:
Scope, locals, and shadowing pitfalls(4/10) - lesson_index:
4598