Lesson 137: Structured text with regular expressions
Focus
Let the literals expose mistaken assumptions quickly: Intermediate drills Structured text with regular expressions; spin token 1175967 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence7mixesStructured text with regular expressions; spin43764. - Ritual: Annotate every meaningful print before deleting noise.
- Guardrail: promise one security boundary if this touched user data.
Example (LESSON_UID = "intermediate-137")
# Intermediate drill L137 topic-13 micro-6 pattern-9
LESSON_UID = "intermediate-137"
spin_a, spin_b, spin_c = 99, 419, 466
def helper(x, bias=14):
return (x * bias + 6) % 5009
samples = [helper(137 + k) for k in range(3 + 13 % 4)]
print(samples, max(samples) - min(samples))
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-137.txt"
snap = [150, 259, 368, 477, 586]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (466 + 131))
Practice
Practice 18: Stress CPU vs clarity trade verbally after micro timing guess. Literal nudge 18.
Fingerprints
- lesson_uid:
intermediate-137 - umbrella band:
Structured text with regular expressions(7/10) - lesson_index:
4395