I am hoping someone can help me with a problem I'm stuck with. I have a large number of tuples (>500) that look like this:
(2,1,3,6)
(1,2,5,5)
(3,0,1,6)
(10,1,1,4)
(0,3,3,0)
A snippet of my code reads:
sum1 = (A,B,C,D) # creates a tuple of sums of (A,B,C,D)
mysum = map(sum, zip(A, B, C, D))
print(mysum)
I realize the above code is not correct. I am trying to find a way to add all the values A together, all the values of B together, all the values of C together, and all the values of D together using the zip function. For example, I would like to print something that looks like this:
Asum = 16
Bsum = 7
Csum = 13
Dsum = 21
Can anyone help please? Thanks very much for your time.