Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python recursion example

# Recursive Factorial Example
# input: 5 
# output: 120 (5*4*3*2*1)
def factorial(x):
    if x == 1:
        return 1
    else:
        return (x * factorial(x-1))
Source by www.datacamp.com #
 
PREVIOUS NEXT
Tagged: #python #recursion
ADD COMMENT
Topic
Name
9+3 =