Python Quest

Track 5 · Lesson 11 of 12

Recursion: functions that call themselves

Solve a problem by reducing it to a smaller version of itself, with a base case that stops the recursion.

About 40 minIntermediate4 exercises

You will be able to

  • Explain what a recursive function is and trace a recursive call step by step
  • Identify the base case and the recursive case of a recursive function
  • Write recursive functions such as factorial and digit sums
  • Recognise a RecursionError and fix a missing or unreachable base case

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.