Sum n numbers in python
def sum_first_n_numbers(n):
'''
Return the sum of n numbers
'''
if n == 1:
return n
else:
return n + sum_first_n_numbers(n-1)
Sum n numbers in python
def sum_first_n_numbers(n):
'''
Return the sum of n numbers
'''
if n == 1:
return n
else:
return n + sum_first_n_numbers(n-1)