Answers for "how to write basic recursive function python"

4

recursion in python

def rec(num):
    if num <= 1:
        return 1
    else:
        return num + rec(num - 1)

print(rec(50))
Posted by: Guest on March-03-2021
0

recursion python examples

# Recursive function factorial_recursion()

def factorial_recursion(n):  
   if n == 1:  
       return n  
   else:  
       return n*factorial_recursion(n-1)
Posted by: Guest on May-22-2021

Code answers related to "how to write basic recursive function python"

Python Answers by Framework

Browse Popular Code Answers by Language