This is a pretty good use case zip.
>>> list1 = [1,2,3,4,5]
>>> list2 = [1,1,1,4,1]
>>> list3 = [1,22,3,1,5]
>>> list4 = [1,2,5,4,5]
>>> [sum(x) for x in zip(list1, list2, list3, list4)]
[4, 27, 12, 13, 16]
or if you have data as a list of lists instead of separate lists:
>>> data = [[1,2,3,4,5], [1,1,1,4,1], [1,22,3,1,5], [1,2,5,4,5]]
>>> [sum(x) for x in zip(*data)]
[4, 27, 12, 13, 16]
Similarly, if you save your data as dictlists, you can use dict.itervalues()or dict.values()to get the values of the list and use them in the same way:
>>> data = {"a":[1,2,3], "b":[3,4,4]}
>>> [sum(x) for x in zip(*data.itervalues())]
[4, 6, 7]
Please note that if your lists are of unequal length, it zipwill work until the shortest list length. For instance:
>>> data = [[1,2,3,4,5], [1,1], [1,22], [1,2,5]]
>>> [sum(x) for x in zip(*data)]
[4, 27]
, , itertools.izip_longest ( fillvalue). :
>>> data = [[1,2,3,4,5], [1,1], [1,22], [1,2,5]]
>>> [sum(x) for x in izip_longest(*data, fillvalue=0)]
[4, 27, 8, 4, 5]