Skip to content

Instantly share code, notes, and snippets.

@gaieges
Created April 10, 2018 20:24
Show Gist options
  • Save gaieges/490cb874bb91411c4eaa4acc19e8be08 to your computer and use it in GitHub Desktop.
Save gaieges/490cb874bb91411c4eaa4acc19e8be08 to your computer and use it in GitHub Desktop.
map / foreach
>>> x = ['a', 'b', 'c']
>>> x
['a', 'b', 'c']
>>> list(map(lambda z: z+'-peen' , x))
['a-peen', 'b-peen', 'c-peen']
>>> for z in x:
... print(z+'-peen')
...
a-peen
b-peen
c-peen
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment