Skip to content

Instantly share code, notes, and snippets.

@JeffLabonte
Created September 16, 2019 19:28
Show Gist options
  • Save JeffLabonte/8acc410b6057fa8c71340aa94bcb559c to your computer and use it in GitHub Desktop.
Save JeffLabonte/8acc410b6057fa8c71340aa94bcb559c to your computer and use it in GitHub Desktop.
>>> def f(x):
return x % 2 != 0 and x % 3 != 0
>>> filter(f, range(2, 25))
[5, 7, 11, 13, 17, 19, 23]
>>> def cube(x):
return x*x*x
>>> map(cube, range(1, 11))
[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]
>>> def add(x,y):
return x+y
>>> reduce(add, range(1, 11))
55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment