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

Python Intermediate — 115: Calibrate iterator cadence with deterministic seeds centred on `pathlib traversal and sanitized writes` [650842]

Lesson 115: pathlib traversal and sanitized writes

Focus

Slow tempo wins; narrate checkpoints aloud: Intermediate drills pathlib traversal and sanitized writes; spin token 975061 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-115")

# Intermediate drill L115 topic-11 micro-4 pattern-10
LESSON_UID = "intermediate-115"
spin_a, spin_b, spin_c = 934, 303, 438

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

cand = [12, 18, 71]
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-115.txt"
    snap = [128, 79, 30]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (438 + 131))

Practice

Practice 12: Inject a benign off-by-one, observe drift, revert with notes. Literal nudge 12.

Fingerprints