Challenges
Read it, trace it, fix it
Most of programming is reading code: your own, other people's, and code that doesn't work yet. These sets practise exactly that. Each one fits after a unit of the course, but you can try any of them whenever you like.
Trace tables
Run the code in your head, line by line, and write down every variable as it changes. The answers come from running the code for real.
Bug hunts
Each program has one mistake. Run it, compare what it does with what it should do, and click the line that's wrong.
Break it down
Split a problem into small functions, write them one at a time, then put them together.
First programs
Follow variables as they change, and find the mistakes in short programs that use print and input.
2 trace tables3 bug hunts1 prediction1 question
Decisions
Work out which branch runs, and fix if statements that take the wrong path.
2 trace tables3 bug hunts1 prediction1 question
Loops
Trace loops one pass at a time, and fix loops that run once too often, or not enough.
2 trace tables3 bug hunts1 prediction1 puzzle
Lists
Watch lists grow and change, and track down the classic list mistakes.
2 trace tables3 bug hunts1 prediction1 question
Functions
Follow values in and out of functions, and fix the mistakes people make with return.
1 trace table3 bug hunts1 exercise1 prediction
Strings, dictionaries and sets
Trace a dictionary as it fills up, and catch the bugs that come from strings that never change.
2 trace tables3 bug hunts1 prediction1 question
Break it down
Split a problem into small functions, write each one, then put them together.
1 bug hunt3 exercises1 puzzle1 question
Classes and objects
Follow an object's attributes as its methods run, and fix the mistakes that come with self.
1 trace table3 bug hunts2 predictions
Algorithms
Trace a binary search step by step, and fix recursion and sorting code that goes wrong at the edges.
1 trace table3 bug hunts1 prediction1 question
Advanced Python
The bugs that catch out experienced programmers, from default values to generators and decorators.
1 trace table4 bug hunts1 prediction1 question