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

Python Intermediate — 013: Decode loop invariants with concurrency hygiene centred on `Generator expressions and laziness` [350588]

Lesson 013: Generator expressions and laziness

Focus

Treat the excerpt as executable notes: Intermediate drills Generator expressions and laziness; spin token 161703 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-013")

# Intermediate drill L013 topic-1 micro-2 pattern-0
LESSON_UID = "intermediate-013"
spin_a, spin_b, spin_c = 703, 120, 765

slogan = "13:1:136"
condensed = "::".join(slogan.split())[::-1]
print(condensed[: (spin_a % 47) + 6])
for part in condensed.split(":"):
    if len(part) > (spin_b % 5) + 1:
        print("probe", hash(part) % (spin_c % 997 + 401))

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-13.txt"
    snap = [26, 735, 453, 171, 880]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (765 + 131))

Practice

Practice 3: Attach property-style expectations referencing tuple shapes. Literal nudge 3.

Fingerprints