Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

map mixed iterators

map works on any iterable, so we might end up passing one list and one string to it.

v1 = ['foo', 'bar', 'baz']
v2 = 'abc'

result = map(lambda x,y: x+y, v1, v2)
print(result)
print( list(result) )

Output:

<map object at 0x7fc5e9ff4e80>
['fooa', 'barb', 'bazc']