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])]
2.1m questions
2.1m answers
60 comments
57.0k users