Created
May 13, 2015 06:00
-
-
Save sooop/8054359e7ecf5df25655 to your computer and use it in GitHub Desktop.
@sh84ahn 님의 gist 에서 comprehension을 적용하도록 변경.
This file contains 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
# [1,2,None] | |
# +[2,None,4] | |
# +[4,3,6] | |
# ------------ | |
# [7, 5, 10] | |
a = [[1,2,None], [2,None,4], [4,3,6]] | |
def zipWith(f, d): | |
b =[[0 if x is None else x for x in y] for y in d] | |
return [f(x) for x in zip(*b)] | |
print(zipWith(sum, a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment