Guest User

Untitled

a guest
Jan 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. ## Lamda
  2. More like an annonymous function
  3.  
  4. `even_num = lambda x: x%2 == 0`
  5. ## Map
  6. Takes a functions/lambda and an iterable, and returns a map object. So convert to list
  7.  
  8. `square = map(lambda x: x*2, [1,2,3,4,5,6])` #[2, 4, 6, 8, 10, 12]
  9.  
  10. ## Filters
  11. Returns an object that holds true to the condition. Takes a functions/lambda and an iterable just like a Map
  12.  
  13. `even = filter(lambda x: x%2 == 0, [1,2,3,4,5,6])` #[2, 4, 6]
Add Comment
Please, Sign In to add comment