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

Python Intermediate — 138: Guard process fences with repeatable chaos centred on `Structured text with regular expressions` [799452]

Lesson 138: Structured text with regular expressions

Focus

Slow tempo wins; narrate checkpoints aloud: Intermediate drills Structured text with regular expressions; spin token 1168785 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-138")

# Intermediate drill L138 topic-13 micro-7 pattern-1
LESSON_UID = "intermediate-138"
spin_a, spin_b, spin_c = 861, 253, 738

left, right = spin_a + 138, spin_b + 7
print(divmod(left + 7, max(3, (spin_c % 9) + 2)))
acc = (870 + 138) % (391 % 881 + 7 + 1)
for step in range(3 + (13 % 4)):
    acc = acc * (spin_a % 11 + 3) % 100003
    if acc % (spin_b % 8 + 2) == 0:
        print("hit", step, acc)
print("trail", acc)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-138.txt"
    snap = [151, 32, 904, 785, 666, 547]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (738 + 131))

Practice

Practice 24: Shadow one variable purposely to spotlight scope quirks. Literal nudge 24.

Fingerprints