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

Python Intermediate — 143: Encode edge literals with narrow scope centred on `datetime, naive vs UTC-aware instincts` [814678]

Lesson 143: datetime, naive vs UTC-aware instincts

Focus

Slow tempo wins; narrate checkpoints aloud: Intermediate drills datetime, naive vs UTC-aware instincts; spin token 1211908 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-143")

# Intermediate drill L143 topic-14 micro-2 pattern-10
LESSON_UID = "intermediate-143"
spin_a, spin_b, spin_c = 174, 883, 269

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

cand = [6, 46, 123]
for candidate in cand:
    lbl, val = gate(candidate)
    print(candidate, lbl, val)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-143.txt"
    snap = [156, 336, 516, 696, 876]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (269 + 131))

Practice

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

Fingerprints