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

Python Basic — 095: Snapshot loop invariants with pattern-match taste centred on `Tuples for fixed bundles` [397756]

Lesson 095: Tuples for fixed bundles

Focus

Assume a reviewer executes this verbatim: Basic drills Tuples for fixed bundles; spin token 812735 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "basic-095")

# Basic drill L095 topic-9 micro-4 pattern-10
LESSON_UID = "basic-095"
spin_a, spin_b, spin_c = 181, 843, 169

def gate(v):
    if v < spin_a + 4:
        return "low", v ** 2
    if v > spin_b + 95:
        return "high", v // max(1, 4 + 1)
    return "mid", v + spin_c

cand = [12, 95, 391]
for candidate in cand:
    lbl, val = gate(candidate)
    print(candidate, lbl, val)

Practice

Practice 25: Discuss packaging layout deltas if helpers became a module. Literal nudge 25.

Fingerprints