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

Python Intermediate — 017: Nudge stream caps with scaffolding comments centred on `Generator expressions and laziness` [692505]

Lesson 017: Generator expressions and laziness

Focus

Assume a reviewer executes this verbatim: Intermediate drills Generator expressions and laziness; spin token 155635 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "intermediate-017")

# Intermediate drill L017 topic-1 micro-6 pattern-4
LESSON_UID = "intermediate-017"
spin_a, spin_b, spin_c = 410, 335, 43

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

from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as scratch:
    target = Path(scratch) / "scratch-17.txt"
    snap = [30, 450, 870, 299, 719]
    target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
    print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (43 + 131))

Practice

Practice 12: Rename locals for domain vocabulary-only; keep behaviour identical. Literal nudge 12.

Fingerprints