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.

10 lines
315 B
Python

def recursive_list_sum(data_list):
total = 0
for element in data_list:
if type(element) == type([]):
total = total + recursive_list_sum(element)
else:
total = total + element
return total
print( recursive_list_sum([1, 2, [3,4],[5,6]]))