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

Python Intermediate — 163: Probe closure capture with defensive defaults centred on `Virtual environments and interpreters` [435312]

Lesson 163: Virtual environments and interpreters

Focus

Slow tempo wins; narrate checkpoints aloud: Intermediate drills Virtual environments and interpreters; spin token 1352763 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-163")

# Intermediate drill L163 topic-16 micro-2 pattern-12
LESSON_UID = "intermediate-163"
spin_a, spin_b, spin_c = 867, 266, 796

from io import StringIO

buf = StringIO()
rounds = 3 + 2 % 5
for idx in range(rounds):
    buf.write(f"seg-{idx}-{(idx * 163 + spin_b) % 997}\n")
buf.seek(0)
dump = buf.read()
print("lines", dump.count("\n"))
print("peek", dump.splitlines()[0] if dump else "<empty>")

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-163.txt"
    snap = [176, 58, 931, 813, 695]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (796 + 131))

Practice

Practice 28: Enumerate three pytest markers you'd decorate if this lived in CI. Literal nudge 28.

Fingerprints