I'm trying to write a function which would sum the items in a list, including items which are lists themselves (or lists of lists...)
def sum_list_recursive(lst):
    sum = 0
    for i in range(len(lst)):
        if type(lst[i]) == "list":
            sum = sum + sum_list_recursive(lst[i])
        else:
            sum = sum + lst[i]
    return sum
Error:
returns: "*Traceback (most recent call last):
  File "C:/Users", line 13, in <module>
    sum_list_recursive([1,2,[3,4],[5,6]])
  File "C:/Users", line 10, in sum_list_recursive
    sum = sum + lst[i]
TypeError: unsupported operand type(s) for +: 'int' and 'list'*"
and I can't tell why or how to fix it.
Thanks in advance!
 
     
     
     
     
     
    