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

Python Basic — 003: Partition loop invariants with fixture parametrization instincts centred on `Your first prints and scripts` [823871]

Lesson 003: Your first prints and scripts

Focus

Anchor one invariant before you branch mentally: Basic drills Your first prints and scripts; spin token 76504 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "basic-003")

# Basic drill L003 topic-0 micro-2 pattern-7
LESSON_UID = "basic-003"
spin_a, spin_b, spin_c = 605, 727, 749

src = [((k + 3) * spin_a + 2) % 241 for k in range(4 + 2 % 3)]
derived = [v * v if v % 2 == 0 else v + spin_b for v in src]
print("src", src)
print("derived", derived)
print("zip_sum", sum(x + y for x, y in zip(src, derived)))

Practice

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

Fingerprints