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

Python Intermediate — 028: Snapshot truthy shells with pattern-match taste centred on `Custom iterators and iter() bridges` [423596]

Lesson 028: Custom iterators and iter() bridges

Focus

Assume a reviewer executes this verbatim: Intermediate drills Custom iterators and iter() bridges; spin token 241787 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-028")

# Intermediate drill L028 topic-2 micro-7 pattern-8
LESSON_UID = "intermediate-028"
spin_a, spin_b, spin_c = 881, 423, 222

pairs = [(5, 28), (7, 2), (28, 71)]
flat = 15
for left, right in sorted(pairs):
    print(left ^ right + flat % 997)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-28.txt"
    snap = [41, 933, 834, 735, 636, 537]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (222 + 131))

Practice

Practice 40: Clone twice: expand literals vs shrink loops; compare narrative. Literal nudge 40.

Fingerprints