Recursive Function

A recursive function is a function that calls itself during its execution. This enables the function to repeat itself several times, outputting the result and the end of each iteration.


Example

#Program to find the factorial of a number using recursion

def fact(n):

  if n==1:

      return 1

   else:

      return n*fact(n-1)

print("the factorial is", fact(5))

Output:

the factorial is 120


About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc






 PreviousNext