This programming language misconception is about the implementation of recursive functions.
You see that the output is the same in both cases.
Thus even a one-branch if
-statement can be enough;
especially if, like here, there is nothing to do in the base case.
If you would like to learn more about this misconception, including its possible origins, symptoms students who hold this misconception might exhibit, the related programming language concepts, links to the corresponding parts of the Python language specification, and related misconceptions, check out RecursiveFunctionNeedsIfElse in the progmiscon.org misconception inventory.
This activity has been created by LuCE Research Lab and is licensed under CC BY-SA 4.0.
RecursiveFunctionNeedsIfElse
PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version bf4622f (Mon, 18 Aug 2025 18:49:36 GMT)