Answers for "what is python recursion"

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

students = {    'Alice': 98,    'Bob': 67,    'Chris': 85,    'David': 75,    'Ella': 54,    'Fiona': 35,    'Grace': 69}
Posted by: Guest on April-08-2021
0

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))
Posted by: Guest on October-02-2020

Python Answers by Framework

Browse Popular Code Answers by Language