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

Python Intermediate — 027: Stress-test typing seams with packaging empathy centred on `Custom iterators and iter() bridges` [381528]

Lesson 027: Custom iterators and iter() bridges

Focus

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

Key ideas

Example (LESSON_UID = "intermediate-027")

# Intermediate drill L027 topic-2 micro-6 pattern-10
LESSON_UID = "intermediate-027"
spin_a, spin_b, spin_c = 665, 917, 85

def gate(v):
    if v < spin_a + 6:
        return "low", v ** 2
    if v > spin_b + 27:
        return "high", v // max(1, 6 + 1)
    return "mid", v + spin_c

cand = [18, 27, 63]
for candidate in cand:
    lbl, val = gate(candidate)
    print(candidate, lbl, val)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-27.txt"
    snap = [40, 715, 399, 83, 758]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (85 + 131))

Practice

Practice 35: Enumerate three pytest markers you'd decorate if this lived in CI. Literal nudge 35.

Fingerprints