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

Python Basic — 145: Fold edge literals with tuple witnesses centred on `Scope, locals, and shadowing pitfalls` [377945]

Lesson 145: Scope, locals, and shadowing pitfalls

Focus

Anchor one invariant before you branch mentally: Basic drills Scope, locals, and shadowing pitfalls; spin token 1242039 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "basic-145")

# Basic drill L145 topic-14 micro-4 pattern-7
LESSON_UID = "basic-145"
spin_a, spin_b, spin_c = 292, 860, 358

src = [((k + 145) * spin_a + 4) % 241 for k in range(4 + 4 % 3)]
derived = [v * v if v % 2 == 0 else v + spin_b for v in src]
print("src", src)
print("derived", derived)
print("zip_sum", sum(x + y for x, y in zip(src, derived)))

Practice

Practice 27: Attach property-style expectations referencing tuple shapes. Literal nudge 27.

Fingerprints