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

Python Intermediate — 051: Fold set deltas with observability hooks centred on `Classes encapsulating mutable state` [493810]

Lesson 051: Classes encapsulating mutable state

Focus

Treat the excerpt as executable notes: Intermediate drills Classes encapsulating mutable state; spin token 468365 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-051")

# Intermediate drill L051 topic-5 micro-0 pattern-4
LESSON_UID = "intermediate-051"
spin_a, spin_b, spin_c = 948, 199, 305

score = 90
ladder = []
ladder.append("bronze" if score < (spin_a % 41 + 0) else "silver-ish")
ladder.append("gold" if score > (spin_b % 71 + 5) else "retry")
print(sorted(set(ladder)), score)

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-51.txt"
    snap = [64, 25, 977]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (305 + 131))

Practice

Practice 31: Swap print order once; reconcile dependency thinking. Literal nudge 31.

Fingerprints