CertGrid CertGrid
Concepts·Certified Entry-Level Python Programmer

Python Recursion

Recursion is part of objective 4.1 and is examined narrowly: given a recursive function, what does it return, and what happens if the base case is missing. Both are answerable by tracing, and this guide traces one on the machine rather than in prose. The cost is worth seeing too - naive `fib(20)` makes 21891 calls, which is a number rather than an opinion.

Functions and Scope Guide 21 of 26 Intermediate

Written against the versions above. The default recursion limit is 1000 and has been for a long time. Python does **not** optimise tail calls, and there is no plan to; a deep recursion will always raise rather than loop.

One machine, and any shell with Python 3 will do - these exams test the language, not a distribution.
Server NameIP AddressOSRolesCPURAMHDD
RUNNER01192.168.0.27Ubuntu 26.04 LTSPython 3.14.4 - the only machine this path needs2 Core4 GB50 GB

Before you start

  1. Factorial, and the two parts every recursion has

  2. What the call stack actually does

  3. Fibonacci, and what it costs

  4. A recursion with no base case

  5. The same job without recursion

  6. What the exam does with recursion

Official sources