Lesson 003: List and dict comprehensions
Focus
Prints are breadcrumbs, not ornamentation: Intermediate drills List and dict comprehensions; spin token 51715 makes this page unlike its neighbours.
Key ideas
- Angle
Intermediate: micro cadence3mixesList and dict comprehensions; spin26671. - Ritual: Describe falsifying evidence that would veto this pattern.
- Guardrail: name the surprise that triggered when literals shifted.
Example (LESSON_UID = "intermediate-003")
# Intermediate drill L003 topic-0 micro-2 pattern-2
LESSON_UID = "intermediate-003"
spin_a, spin_b, spin_c = 783, 977, 946
blob = "0|C"
head, sep, tail = blob.partition("|")
print(tuple(zip(head, reversed(tail))))
filt = [ch for ch in head if ord(ch) % (spin_a % 5 + 2) != 0]
print("filt", filt)
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-3.txt"
snap = [16, 805, 603, 401, 199]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (946 + 131))
Practice
Practice 23: Rename locals for domain vocabulary-only; keep behaviour identical. Literal nudge 23.
Fingerprints
- lesson_uid:
intermediate-003 - umbrella band:
List and dict comprehensions(3/10) - lesson_index:
79