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

Python Intermediate — 022: Snapshot logging cadence with property-test curiosity centred on `Custom iterators and iter() bridges` [234085]

Lesson 022: Custom iterators and iter() bridges

Focus

Prints are breadcrumbs, not ornamentation: Intermediate drills Custom iterators and iter() bridges; spin token 181268 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-022")

# Intermediate drill L022 topic-2 micro-1 pattern-9
LESSON_UID = "intermediate-022"
spin_a, spin_b, spin_c = 933, 652, 834

def helper(x, bias=46):
    return (x * bias + 1) % 5009

samples = [helper(22 + k) for k in range(3 + 2 % 4)]
print(samples, max(samples) - min(samples))

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-22.txt"
    snap = [35, 973, 920, 867]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (834 + 131))

Practice

Practice 11: Discuss packaging layout deltas if helpers became a module. Literal nudge 11.

Fingerprints