Start free

Python practice

Python exercises that check your code as you go.

264 exercises, from your first print() to graph algorithms. Write real Python in your browser, check it against tests, and see in plain English what to fix. No sign-up.

  • Real Python 3.14
  • Errors explained
  • input() works
  • Progress kept in your browser

264 exercises

NoviceFirst programs: print, input, arithmetic and simple text.

Arithmetic

BeginnerDecisions and loops: if, for and while, lists and strings.

IntermediateFunctions, dictionaries, nested loops and working with text.

AdvancedRecursion, sorting and searching, stacks, queues and classes.

ExpertAlgorithms: graphs, dynamic programming, backtracking and more.

The topics

Each with the idea in a minute, an example, and the mistake to watch for.

Questions

Do I need an account?
No. Open an exercise and start typing. Your code and the exercises you solve are kept in this browser, on this device, until you clear its data.
Which Python is it?
Real Python 3.14, running in your browser (Pyodide), with its standard library. Nothing to install, and your code never leaves your computer to run.
How is my code checked?
Check runs your program on each example and on hidden tests, then compares what it printed with the answer. A test that fails says why, in plain English, with what was expected beside what your program printed.
Why are some tests hidden?
So a program has to solve the problem, not just print the examples' answers. A hidden test that fails shows you the input it was given, so you can work out what your program missed.
Can I see a solution?
Once your code passes every test, you can compare it with ours. Not before: tutors set these exercises as homework. Stuck? Each exercise has the idea behind its topic, with an example.
Does input() work?
Yes. Press Run and your program asks in the output, as it would in a terminal: type the answer and press Enter. Check gives your program each test's input by itself.
Is it for GCSE and A level?
Novice to Intermediate cover what GCSE Computer Science asks you to program: input and output, decisions, loops, strings, lists, functions, searching and sorting. Advanced and Expert go on to A level and beyond: recursion, classes, stacks and queues, graphs.