Given a tuple containing a bunch of integer elements, how can one find the sum of all the elements?
For example, if I have a list of tuples:
li = [(1
You could use list comprehension.
>>> li = [(1, 2), (1, 3), (2, 3)] >>> [x+y for (x,y) in li] [3, 4, 5]