All learning paths Learn See Try Make Follow a small program line by line What this lesson is about Say out loud what each line does and what the values are, before you decide anything about the code.
A friend sends you fifteen lines of code that print the top three names, and asks if it works. How do you read it?
A Read the last line to see what it prints, then work back up only if that looks wrong. B Read it through once and write one sentence saying what the whole thing does. C Read a program top to bottom, saying aloud what each line does to what.
Check my recall Why this matters The Python tutorial starts with the equals sign putting a value into a name, and printing nothing. Evaluation work asks you to judge a program, not to write one.
You can say, line by line, what a small program does and what each name holds.
The Python tutorial starts with the equals sign putting a value into a name, and printing nothing. Evaluation work asks you to judge a program, not to write one.
Read a program top to bottom, saying aloud what each line does to what. Track the values, not the words: write what each name holds after each line. You can judge code you could not have written; reading is its own skill. Task A fifteen-line program reads a list of marks and prints the top three names.
Weak approach Reading the last line only, seeing that it prints three names, and saying the program sorts and prints. The lines that change the list before that were never read.
Stronger approach One plain sentence for each line, and a small table showing the list after every change to it.
Why the stronger approach works The weak reading missed that the sorting ran before the filter, which changed the three names printed.
Try a changed situation No code today: you are checking a hand-written ledger where a clerk carried a balance forward across six pages. How do you read it?
Make something yourself Take a fifteen-line program you did not write. Write one plain sentence for each line, and a table of what every name holds during one run of it.
Lesson 1 of 10 on Coding for evaluation work next Run Python on your own phone Part 1 ends in a work sample you can send
Read the primary or official source: Python documentation · an informal introduction