Last active
November 21, 2017 22:33
-
-
Save pykong/569d7c42c951f7423cec28a672cc3fb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import izip // you may also just use zip | |
l = [(1, 2), (3, 4), (5, 6), (7, 8), (9, 0)] | |
result = [sum(x) for x in izip(*l)] | |
print(result) | |
>>> [25, 20] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment