Answers for "write a recursive python program that calculates x!"

3

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

What Is Python Recursive Function in python

pythonCopydef fact(n):
    """Recursive function to find factorial"""
    if n == 1:
        return 1
    else:
        return (n * fact(n - 1))
a = 6
print("Factorial of", a, "=", fact(a))
Posted by: Guest on November-29-2021

Code answers related to "write a recursive python program that calculates x!"

Python Answers by Framework

Browse Popular Code Answers by Language