Learn practical skills, build real-world projects, and advance your career
Created 2 years ago
Recursion
we know that in Python,a function can call other functions or it can even call itself.These type of
construct are called as Recursive Functions
#Factorial of a No.
def factorial(num):
return 1 if num == 1 else (num * factorial(num - 1))
num = int(input("Enter a number:"))
print("Factorial of {} is {}".format(num,factorial(num)))
Enter a number:10
Factorial of 10 is 3628800