What is the analogue of Haskell's zipWith function in Python?
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
map()
map(operator.add, [1, 2, 3], [3, 2, 1])
Although a LC with zip() is usually used.
zip()
[x + y for (x, y) in zip([1, 2, 3], [3, 2, 1])]
1.4m articles
1.4m replys
5 comments
57.0k users