Home › Python Output Practice
Python output prediction practice
🔮 24 output questionsFree, no loginInterview-style
How this archive works
Every card is a "predict the output" question — the exact format used in Python interviews and university exams. The featured questions below run right on the page: type your predicted output, check it, and get a line-by-line trace of why. The rest open in PyDebug's interactive editor, which verifies your prediction automatically.
New to the format? Start with the output-prediction strategy guide, then come back and drill.
Filter
Answer on this page
Print a list slice
Three slices of the same five-element list. Every one of them is governed by a single rule — slices include th…
lists easyfor loop with range and step
Two rules interact here: what range(1, 10, 3) actually generates, and what the loop variable holds after the l…
loops mediumString multiplication
String multiplication repeats the whole string — and every later line operates on the result, not the original…
strings easyAnswer in the interactive editor
break vs continue
Interactive — predict in the editor, get checked instantly.
loops mediumLoop variable after the loop ends
Interactive — predict in the editor, get checked instantly.
loops mediumelse clause on a for loop
Interactive — predict in the editor, get checked instantly.
loops mediumenumerate with a start value
Interactive — predict in the editor, get checked instantly.
loops easyList multiplication
Interactive — predict in the editor, get checked instantly.
lists mediumNegative indexing
Interactive — predict in the editor, get checked instantly.
lists easyList copy vs reference
Interactive — predict in the editor, get checked instantly.
lists easySlicing excludes the end index
Interactive — predict in the editor, get checked instantly.
lists easyString repetition and length
Interactive — predict in the editor, get checked instantly.
strings easyString multiplication and indexing
Interactive — predict in the editor, get checked instantly.
strings easyString multiplication in a loop
Interactive — predict in the editor, get checked instantly.
strings mediumDefault parameter values
Interactive — predict in the editor, get checked instantly.
functions mediumFunction returning nothing
Interactive — predict in the editor, get checked instantly.
functions easyChained assignment
Interactive — predict in the editor, get checked instantly.
functions easyMutable default argument trap
Interactive — predict in the editor, get checked instantly.
functions mediumdict.get() with a default
Interactive — predict in the editor, get checked instantly.
dictionaries mediumDictionary keys must be unique
Interactive — predict in the editor, get checked instantly.
dictionaries mediumTuple immutability
Interactive — predict in the editor, get checked instantly.
tuples easySets remove duplicates
Interactive — predict in the editor, get checked instantly.
sets easytry/except/else flow
Interactive — predict in the editor, get checked instantly.
exceptions mediumClass variable shared across instances
Interactive — predict in the editor, get checked instantly.
oop mediumWhy output prediction makes you a better debugger
Debugging is prediction in reverse: you read code that already misbehaved and reconstruct what it must have done. Practising forward prediction — stating exactly what each line prints before running it — builds the same mental interpreter. The learners who get fast at these questions are the same ones who stop needing twenty print statements to find a bug.
Struggling with a specific crash instead? The Python error explainer decodes the six most common exceptions, and the tricks collection catalogues the classic traps.