Write a function to find sum of nested list using Recursion
Topic: Write a function to find sum of nested list using Recursion
Solution
total = 0 def sum_nestedlist(l): global total for j in range(len(l)): if type(l[j]) == list: sum_nestedlist(l[j]) else: total += l[j] sum_nestedlist([[1, 2, 3], [4, [5, 6]], 7]) print(total)
List all Python Programs