recursive program in python code example
Example 1: recursion in python
def rec(num):
if num <= 1:
return 1
else:
return num + rec(num - 1)
print(rec(50))
Example 2: Recursion Python
students = { 'Alice': 98, 'Bob': 67, 'Chris': 85, 'David': 75, 'Ella': 54, 'Fiona': 35, 'Grace': 69}