15. Python Chapter 4 — functions and recursion - revision mindmap

All mindmaps · Full chapter · Practice answers

Detailed six-branch revision mindmap for Python Chapter 4 — functions and recursion

Open full-resolution image · Printable collection - page 15

The map is a completed revision summary. Cover a branch and reconstruct it, then try the linked chapter practice. Read the image at full size when labels are small.

Text version

Function interface

  • Definition versus call
  • Parameter versus argument
  • Return value versus printed output
  • None when no value returned; tuple for multiple results

Scope and shared objects

  • Local binding per invocation
  • Module-level global binding
  • Reading versus shadowing versus global rebinding
  • Mutating shared object versus rebinding local parameter

Recursive design

  • State the valid input domain
  • Base case and base result
  • Recursive step makes progress
  • Combine the smaller result correctly

Call stack

  • One frame per unfinished invocation
  • Arguments/local values and continuation
  • Descent pauses the caller
  • Unwinding resumes the most recent unfinished caller

Compare and translate

  • Recursive relation → initial iterative result
  • Number of updates and bounds
  • Clarity, call overhead and stack space
  • RecursionError when depth becomes excessive

Worked example & exam traps

  • fact(3) = 3 × fact(2); fact(2) = 2 × fact(1); fact(1) = 1.
  • Returns unwind: 1 → 2 → 6. These base rules give 3 calls.
  • A function with only print(6) displays 6 but returns None.
  • Avoid: return n before inner call finishes; unreachable base; wrong base value

Sources and reading

This map condenses Chapter 15 and its source trail. Use the self-learning reading guide for the corresponding VJC pages and A notes. It does not add topics to the stated promo scope.