What a first Python exam actually asks#
Almost every question in a first Python course is one of four shapes. Knowing which four changes what studying should look like:
| Shape | Looks like | What it really tests |
|---|---|---|
| Trace the output | “What does this print?” | whether you can be the interpreter for ten lines |
| Name the error | “Which error does line 3 raise?” | whether you know the error family by name, not by vibe |
| Write a short function | “Return the largest value in a list” | the loop patterns: accumulate, count, find-the-max |
| Fix or explain | “Why does this give the wrong answer?” | off-by-one, aliasing, and comparing values that are still strings |
Not one of them is answered by recognising code. They are all answered by producing something — an output, a name, a function, a diagnosis. That gap between recognising and producing is the whole problem with how most people study, and it has a well-measured fix.
The short version#
- Close the notes and answer questions. Retrieving something is what makes it stick; rereading it mostly makes it feel familiar.
- Spread the sessions out. Four half-hours across four days beats one two-hour block, at no extra cost.
- Read the explanation for every question — especially the ones you got right for the wrong reason.
- Trace code with a pen and a table, one column per variable. Doing it in your head is where the mistake hides.
- Type the programs. Python is not a spectator subject, and a two-line experiment settles most arguments faster than a paragraph does.
The evidence behind the first three is summarised in the Sources section — we cite it rather than restate it.
1. Stop rereading the chapter#
Rereading is the most popular study method and one of the least effective per hour spent. It produces fluency — the text feels easy, so it feels learned — without producing the ability to recall anything with the book shut. An exam is the book shut.
The replacement is not complicated: close everything and answer a question. For Python that has an unusually concrete form. Cover the output of any example in your notes and predict it. Write your prediction down. Then run it.
Writing the prediction down is the part people skip, and it is the part that works. An unwritten prediction quietly rearranges itself into whatever the real answer turns out to be, and you learn nothing. A written one is either right or wrong, and a wrong one shows you exactly which belief to fix.
2. Spread the work out#
The same total hours, split across more days, produce more durable learning than one long block. This is one of the most reliably reproduced results in the study of learning, and it is free — it asks for scheduling, not effort.
It also fits how programming actually goes wrong. A concept you half-understand on Monday will fail visibly on Wednesday when you try to use it, and you still have Thursday to fix it. Cram everything into the night before and the failure and the exam happen at the same time.
Studying does not have to look like studying. Ten trace-the-output questions on a phone between classes is a genuine retrieval session. The scheduling matters more than the length, and short sessions are the ones that actually happen.
3. Always read the explanation#
Answering a question and moving on captures maybe half the value. The other half is in the feedback, and it matters most in two cases people usually skip.
The ones you got right for the wrong reason. You guessed between two options, or you recognised the shape of the code without following it. Right answer, no knowledge, and no way to tell the difference next time — unless you read why.
The ones where you were confident and wrong. These are the most valuable questions you will ever see, because a confidently wrong belief is invisible from the inside. It will keep producing wrong answers until something contradicts it, and a question you got wrong is that contradiction arriving early, while it is still cheap.
4. Trace code by hand#
“What does this print?” is the most common question in a first Python course, and it cannot be answered by reading harder. It is answered with a pen.
for i in range(3):
for j in range(i):
print(i, j)
What does it print? Most people say nine lines, or six. Work it out before you scroll.
1 0
2 0
2 1
Three lines. The trap is the inner range(i): on the first pass i is 0, and
range(0) is empty, so the inner loop body never runs at all. On the second pass it runs once, on the
third twice. Nothing about that is difficult — it is only difficult to hold in your head.
So do not hold it in your head. Draw a table, one column per variable, one row per pass:
i | range(i) | j takes | printed |
|---|---|---|---|
| 0 | range(0) | nothing | — |
| 1 | range(1) | 0 | 1 0 |
| 2 | range(2) | 0, 1 | 2 0, 2 1 |
Four rows of handwriting and the answer is not in question. On an exam this is worth more than any amount of
staring, and it is the single most transferable skill in the course — the same table answers a
while loop, an accumulator, and a swap.
5. The five things most often got wrong#
If your time is short, these five account for a large share of lost marks in a first Python course. Each one has a guide with the executed output:
- Arithmetic on
input()without converting.input()always returns a string. Variables and types. - Changing one list and finding another changed too. Two names, one list. Lists, tuples and aliasing — the highest-yield topic on this list.
returnversusprint. A function that prints gives the callerNone. Functions and scope.- Off-by-one in a loop.
range(len(xs) - 1)silently drops the last item. Errors and debugging. - A condition that is always true.
if x == 1 or 2:does not mean what it reads like. Booleans and conditionals.
A two-week plan you can actually follow#
Roughly forty minutes a day, and no day that depends on the day before going well:
| Days | What to do |
|---|---|
| 1–2 | Types and conversion. Predict-then-run every example in your notes. Write the predictions down. |
| 3–4 | Conditionals and loops. Trace five nested loops with a table — no running them first. |
| 5–6 | Functions, return vs print, and scope. Write three short functions from a one-line description. |
| 7 | Rest, or redo only the questions you got wrong so far. Nothing new. |
| 8–9 | Lists, tuples, aliasing. Draw the names-and-values picture for every example. |
| 10–11 | Strings, slicing, dictionaries and files. |
| 12 | Errors: name the error for twenty broken lines, and read one traceback bottom-up out loud. |
| 13 | A full mixed set under exam conditions — timed, closed notes, no running the code. |
| 14 | Only your wrong answers from day 13. Nothing new the night before. |
Day 7 and day 14 are load-bearing. Reviewing what you got wrong is worth more per minute than covering something new, and the night before an exam is the worst possible time to meet an unfamiliar topic.
If you are teaching yourself#
Without a course you are missing two things, and only one of them matters much.
You are missing a sequence — easily solved. Types and input, then conditionals, then loops, then functions and scope, then lists and aliasing, then strings, then dictionaries and files. That order is not arbitrary: each one is used by the next.
You are missing a deadline that forces retrieval, and that is the real gap. A course makes you produce answers on a schedule whether you feel ready or not. Alone, it is easy to spend six weeks reading and never once find out what you cannot do. Set your own retrieval deadline in the first week, not the last — a timed set of questions every Friday, with the notes shut. What you get wrong is the syllabus.
Test yourself in the free Kestrel Exams app
Topic-selectable practice — offline, no ads, no account.
Open the Python app →Frequently asked questions#
What is the best way to study for a Python exam?
Answer questions with your notes closed, spread over several days, and read the explanation for every one — including the ones you got right. For Python specifically, add hand-tracing: predict the output in writing before you run it. Rereading the chapter feels productive and is one of the weakest uses of an hour.
How far in advance should I start studying?
Two weeks of short daily sessions beats one long night, and it costs no extra hours — the same total time split across more days produces more durable learning. It also gives a concept you half-understand on Monday time to fail visibly on Wednesday, while you can still fix it.
What kinds of questions does a first Python exam ask?
Four shapes: trace the output of a short program, name the error a broken line raises, write a short function from a description, and explain why a program gives the wrong answer. None of them can be answered by recognising code — they all require producing something.
How do I get better at trace-the-output questions?
Use a table rather than your head: one column per variable, one row per pass through the loop, and write the values down as they change. Predict in writing, then run the program to check. The habit transfers to while loops, accumulators and swaps.
What do students most often get wrong in a first Python course?
Arithmetic on input() without converting it from a string; changing one list and finding another changed too; confusing return with print; off-by-one errors from range(len(xs) - 1); and conditions like if x == 1 or 2 that are always true.
Is it worth reading the explanation when I got the question right?
Yes, and those are often the most valuable ones. If you guessed between two options, or recognised the shape of the code without following it, a right answer hides the fact that you could not do it again. The explanation is the only thing that tells you which it was.
Sources#
The claims about retrieval practice, spacing, and feedback on this page come from the research summarized in our two companion articles, which carry the full citations: The testing effect, explained and Spaced repetition for exams. For the day itself, see The exam day playbook. Every Python listing and every line of output on this page was executed against CPython 3.11 before publication.
Something here not clear? A topic you wish we covered? Tell us. We read every message, and a request is the fastest way to get a guide written — several of these exist because somebody asked.
