Recursion is a method where the solution to a problem depends on solutions to smaller instances of the same problem. In python, keyword 'def' use to define a function. It must be
followed by the function name and the parenthesized list of formal parameters.
The statements that form the body of the function start at the next line, and
must be indented. For recursion need to call the same function inside that same function with a condition. Take a look at our recursive factorial code.
Comments
Post a Comment