❮ Previous Next ❯

Python 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


❮ Previous Next ❯


Follow Us




  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved