I have a nested list called list_6:
[[-1, 1, -1, 1, -1, 1, 1, 0, -1, 0, -1, -1, 1, 1, 1, 0, 1, -1, -1, -1, 1, 1, 1, 0, 0, -1, 0, 0, 0, 1, 0, -1, 1, 1, -1, 0, 0, 1, 1, -1, 0, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1],...]]
each element of the list contains integers from -1,1, and the elements are of unequal length, there are 20 elements in the list
I would like to create a new list called list_7 that looks like:
[[13],[4],[5],...]], so that each element in the nested list is summed, and the result is printed. I tried using iter.zip_longest:
[sum(i) for i in itertools.zip_longest(*list_6, fillvalue=0)]
but am getting an error function:
'str' object is not callable