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
- Angle
Intermediate: micro cadence6mixespathlib traversal and sanitized writes; spin31530. - Ritual: Annotate every meaningful print before deleting noise.
- Guardrail: pick the budget that keeps this rehearsal honest.
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
- lesson_uid:
intermediate-116 - umbrella band:
pathlib traversal and sanitized writes(6/10) - lesson_index:
3716