DP Computer Science · HL Python

Practice & resources

Watch an algorithm, try it in Python, or check your understanding with review questions.

Lessons explain each topic. Handouts contain the class exercises. Use this page to explore and revise.

Run Python

Write and run code in your browser. Load an example, predict the output, then change it and run it again.

Open Python playground →

Watch & trace

Step through an algorithm with its Python code beside it. Pause before each line and predict what changes.

Open the animations ↓

Searching & sorting animations

All B2.4 animations →

More B2.4 animations

B2.4.2 · Searching

Trace a search from the first comparison to the returned index.

For HL recursion, practise writing and tracing simple non-branching functions. Quicksort, tree traversal and fractals show applications to explore.