A short program goes on the board. Before anyone touches a keyboard,
you commit to a prediction β the exact output, in ink. Then we run
it. Being wrong costs nothing; refusing to commit costs everything β
the gap between prediction and reality is where the learning lives.
How to run it
Read the program twice, silently β no talking yet.
Write the exact output you expect, character for character.
Compare with a neighbour; the code, not volume, settles disputes.
Run it. Surprised? The line that fooled you is todayβs lesson.
One program, three defensible readings (click to expand)
x = "5"y = x + xprint(y)
10 β five plus five. 55 β the quotation marks make x text,
and + glues text together. A crash β you cannot add words. Only
one reading is what Python does; the quotation marks decide it.
Expressions and operator precedence (click to expand)
a = 10 + 4 * 2 ** 3b = (10 + 4) * 2 ** 3print(a, b)
42 112 β in a, exponentiation (23=8) and multiplication
(4Γ8=32) happen before addition (10+32=42). In b,
parentheses force addition first (14Γ8=112). Order of
operations decides every compound expression.
One variation
Reverse it: show only the output; pairs write a program that would
produce it. There is never just one answer β which is the point.
Commit before you run
A guess never written down cannot surprise you, and code that never
surprises you never teaches you β Debugging Is the Job says why.
Curriculum connection
C1.3
identify various types of data and explain how they are used within programs