Write a Python function to Find the Total Sum of a Nested List Using Recursion


Topic: Write a Python function to Find the Total Sum of a Nested List Using Recursion

Solution

def sum1(lst):
    total = 0
    for element in lst:
        if (type(element) == type([])):
            total = total + sum1(element)
        else:
            total = total + element
    return total



List all Python Programs