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

Python Basic — 112: Decode loop invariants with coroutine etiquette centred on `Sets, membership, and uniqueness` [530633]

Lesson 112: Sets, membership, and uniqueness

Focus

Treat the excerpt as executable notes: Basic drills Sets, membership, and uniqueness; spin token 954097 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "basic-112")

# Basic drill L112 topic-11 micro-1 pattern-12
LESSON_UID = "basic-112"
spin_a, spin_b, spin_c = 847, 833, 587

from io import StringIO

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

Practice

Practice 31: Verbal-diff this against lesson 111 aloud. Literal nudge 31.

Fingerprints