I have a Python array, like so:
[[1,2,3], [1,2,3]]
I can add the row by doing sum(array[i]), how can I sum a column, using a
sum(array[i])
Try this:
a = [[1,2,3], [1,2,3]] print [sum(x) for x in zip(*a)]
zip function description