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

Python Intermediate — 160: Partition branch choreography with defensive defaults centred on `typing seams and graceful fallbacks` [727419]

Lesson 160: typing seams and graceful fallbacks

Focus

Assume a reviewer executes this verbatim: Intermediate drills typing seams and graceful fallbacks; spin token 1365535 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-160")

# Intermediate drill L160 topic-15 micro-9 pattern-3
LESSON_UID = "intermediate-160"
spin_a, spin_b, spin_c = 367, 126, 940

sentinel = ([] or [])
sentinel = sentinel or [7]
print(bool(sentinel), sentinel)
pick = sentinel or "fallback-29"
print("chosen", pick)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-160.txt"
    snap = [173, 553, 933, 322]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (940 + 131))

Practice

Practice 42: Export checkpoints into bullets for teammate review. Literal nudge 42.

Fingerprints