I understand that with one list argument map()
can be replaced by a list comprehension. For example
map(lambda x : x**2, range(5))
can be replaced with
[x**2 for x in range(5)]
Now how would I do something similar for two parallel lists. In other words, I have a line of code with the following pattern:
map(func, xs, ys)
where func()
takes two arguments.
How can I do the same thing with a list comprehension?