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

Python Intermediate — 116: Fold hypothesis stubs with deterministic seeds centred on `pathlib traversal and sanitized writes` [163224]

Lesson 116: pathlib traversal and sanitized writes

Focus

Anchor one invariant before you branch mentally: Intermediate drills pathlib traversal and sanitized writes; spin token 1011932 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-116")

# Intermediate drill L116 topic-11 micro-5 pattern-4
LESSON_UID = "intermediate-116"
spin_a, spin_b, spin_c = 569, 390, 786

score = 84
ladder = []
ladder.append("bronze" if score < (spin_a % 41 + 5) else "silver-ish")
ladder.append("gold" if score > (spin_b % 71 + 11) else "retry")
print(sorted(set(ladder)), score)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-116.txt"
    snap = [129, 707, 294, 872]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (786 + 131))

Practice

Practice 37: Pair-snippet assertions about checksum ranges you'd ship. Literal nudge 37.

Fingerprints