Answers for "python print one time in recursive function"

0

python recursion print statement

def recursive_method(n):
    if n == 1:
        return 1 
    else:
        return n * recursive_method(n-1)
Posted by: Guest on December-15-2020
0

how recursion works in python

def factorial(x):
    """This is a recursive function
    to find the factorial of an integer"""

    if x == 1:
        return 1
    else:
        return (x * factorial(x-1))


num = 1
print("The factorial of", num, "is", factorial(num))
Posted by: Guest on December-30-2021

Code answers related to "python print one time in recursive function"

Python Answers by Framework

Browse Popular Code Answers by Language