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

Python Basic — 143: Stress-test exception seams with repeatable chaos centred on `Scope, locals, and shadowing pitfalls` [554236]

Lesson 143: Scope, locals, and shadowing pitfalls

Focus

Treat the excerpt as executable notes: Basic drills Scope, locals, and shadowing pitfalls; spin token 1218438 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "basic-143")

# Basic drill L143 topic-14 micro-2 pattern-2
LESSON_UID = "basic-143"
spin_a, spin_b, spin_c = 383, 997, 449

blob = "8|C"
head, sep, tail = blob.partition("|")
print(tuple(zip(head, reversed(tail))))
filt = [ch for ch in head if ord(ch) % (spin_a % 5 + 2) != 0]
print("filt", filt)

Practice

Practice 21: Shadow one variable purposely to spotlight scope quirks. Literal nudge 21.

Fingerprints