Topic hubs

Python practice by topic.

Twelve focused hubs for the parts of Python beginners practise most. Each page has a short editorial guide, common mistakes, ten answered questions, and a direct link into the matching part of the full bank.

12 topics · 120 sample questions · answers included

Data structures

Python lists: practice questions with answers.

Lists are the first data structure most beginners use every day. This page checks whether you can read an index, change a list in place, and choose a method without guessing what i…

82 questions · 10 sample answers
Data structures

Python tuples: practice questions with answers.

A tuple looks like a list with parentheses, but the differences change how you unpack data, protect values, and build dictionary keys. These questions test the details beginners us…

39 questions · 10 sample answers
Data structures

Python dictionaries: practice questions with answers.

Dictionaries are how Python code stores labelled data: one key, one value, and a lookup that should be fast. The useful skill is not memorising every method; it is knowing what hap…

50 questions · 10 sample answers
Core syntax

Python strings: practice questions with answers.

String questions expose small mistakes quickly: an off-by-one slice, a method that returns a new string instead of changing the original, or a missing space in formatted output. Th…

86 questions · 10 sample answers
Control flow

Python loops: practice questions with answers.

Loops are where a program starts doing repetitive work. The common failures are mechanical: an off-by-one range, an accumulator that never updates, or a while condition that never …

61 questions · 10 sample answers
Control flow

Python conditionals: practice questions with answers.

Conditionals look simple until two branches overlap or a truthy value surprises you. These questions check the order of checks, the difference between assignment and comparison, an…

43 questions · 10 sample answers
Core syntax

Python functions: practice questions with answers.

A function is not just a block of code with a name. It is a boundary: values go in, a result comes out, and local names should not leak. These questions test that boundary.…

35 questions · 10 sample answers
Advanced features

Python list comprehensions: practice questions with answers.

A comprehension packs a loop, an expression, and sometimes a filter into one line. The syntax is compact, but the order of the for and if clauses is what beginners usually need to …

40 questions · 10 sample answers
Working with data

Python file handling: practice questions with answers.

File questions reward precision. The mode decides whether a file is read, overwritten, or appended; the with block decides whether it is closed; the encoding decides whether non-AS…

38 questions · 10 sample answers
Error handling

Python exceptions: practice questions with answers.

Exception handling is not about hiding errors. It is about deciding which errors you can recover from, which ones should stop the program, and what the caller needs to know. These …

39 questions · 10 sample answers
Object-oriented Python

Python classes: practice questions with answers.

Classes become useful when data and the operations on that data belong together. The first hurdles are mechanical: what self refers to, where attributes are created, and why one sh…

44 questions · 10 sample answers
Exam skill

Python output prediction: practice questions with answers.

Output prediction is a compact test of your mental model. You have to track values, mutation, formatting, and the exact characters printed, not just the general idea of the code.…

850 questions · 10 sample answers

Choose from 3,000 questions, or start with a topic above.