You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
7 lines
187 B
Python
7 lines
187 B
Python
5 years ago
|
def list_sum(num_List):
|
||
|
if len(num_List) == 1:
|
||
|
return num_List[0]
|
||
|
else:
|
||
|
return num_List[0] + list_sum(num_List[1:])
|
||
|
|
||
|
print(list_sum([2, 4, 5, 6, 7]))
|