Solution 1:
Using just sum
and zip
as you mention, however zip
still returns a generator, which is memory efficient, not sure why you think otherwise.
list(map(sum, (zip(*a))))
Using just sum
and zip
as you mention, however zip
still returns a generator, which is memory efficient, not sure why you think otherwise.
list(map(sum, (zip(*a))))