[(-2.3391885553668246e-10, 8.473071450645254e-10), (-2.91634014818891e-10, 8.913956007163883e-10), (-3.470135547671147e-10, 9.186162538099684e-10), (-3.9905561869610444e-10, 8.425016542750256e-10), (-4.4700997526371524e-10, 8.681513230068634e-10), (-4.903967399792693e-10, 9.204845678073805e-10),....
I have given this result in a code that I wrote. I would like to add up all of the components on the left side of the two terms in the parenthesis. How do I do this? I don't know what type of array this is and so I don't know how to deal with it.
It is a list of tuples. You can try the following:
tuples = [
(-2.3391885553668246e-10, 8.473071450645254e-10),
(-2.91634014818891e-10, 8.913956007163883e-10),
(-3.470135547671147e-10, 9.186162538099684e-10),
(-3.9905561869610444e-10, 8.425016542750256e-10),
(-4.4700997526371524e-10, 8.681513230068634e-10),
(-4.903967399792693e-10, 9.204845678073805e-10),
]
result = sum(t[0] for t in tuples)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.