Lesson 048: Booleans, comparisons, and truthiness
Focus
Let the literals expose mistaken assumptions quickly: Basic drills Booleans, comparisons, and truthiness; spin token 422200 makes this page unlike its neighbours.
Key ideas
- Angle
Basic: micro cadence8mixesBooleans, comparisons, and truthiness; spin17701. - Ritual: Sketch control flow as ASCII before trusting output.
- Guardrail: promise one security boundary if this touched user data.
Example (LESSON_UID = "basic-048")
# Basic drill L048 topic-4 micro-7 pattern-7
LESSON_UID = "basic-048"
spin_a, spin_b, spin_c = 650, 611, 276
src = [((k + 48) * spin_a + 7) % 241 for k in range(4 + 7 % 3)]
derived = [v * v if v % 2 == 0 else v + spin_b for v in src]
print("src", src)
print("derived", derived)
print("zip_sum", sum(x + y for x, y in zip(src, derived)))
Practice
Practice 26: Rename locals for domain vocabulary-only; keep behaviour identical. Literal nudge 26.
Fingerprints
- lesson_uid:
basic-048 - umbrella band:
Booleans, comparisons, and truthiness(8/10) - lesson_index:
1554