Python Recursion
In this lecture, you will learn to create a recursive function (a function that calls itself).
What is recursion?
Python Recursive Function
Python Recursive Function
def factorial(x):
"""This is a recursive function
to find the factorial of an integer"""
if x == 1:
return 1
else:
return (x * factorial(x-1))
num = 3
print("The factorial of", num, "is", factorial(num))Advantages of Recursion
Disadvantages of Recursion
Last updated

