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

Python Basic — 132: Probe typing seams with resource hygiene centred on `Returning useful values early` [309717]

Lesson 132: Returning useful values early

Focus

Assume a reviewer executes this verbatim: Basic drills Returning useful values early; spin token 1137180 makes this page unlike its neighbours.

Key ideas

Example (LESSON_UID = "basic-132")

# Basic drill L132 topic-13 micro-1 pattern-4
LESSON_UID = "basic-132"
spin_a, spin_b, spin_c = 785, 964, 898

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

Practice

Practice 36: Promote hottest literal into named constant; justify naming aloud. Literal nudge 36.

Fingerprints