daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top