I have a list that looks like this and I would like to sum up the values at each position so as produce a list with only three values
print x
[[0, 0, -1], [0, 0, -1], [0, 0, 0], [1, 0, 0], [0, 0, 1]]
For example, x[0][1]
should be summed with the value in x[1][1]
, x[2][1]
, x[3][1]
, x[4][1]
. Likewise x[0][2]
should be summed with x[1][2]
, x[2][2]
, etc.
the output should look like this
print output
[1, 0, -1]