Skip to content

Instantly share code, notes, and snippets.

Created April 21, 2012 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2434554 to your computer and use it in GitHub Desktop.
Save anonymous/2434554 to your computer and use it in GitHub Desktop.
from itertools import takewhile
big_list = [1, 2, 3, 4, 5,6, 6, 8, 9, 10]
less_than_9 = takewhile(lambda x: x < 9.0, big_list)
between_9_and_3 = (i for i in less_than_9 if i > 3.0)
for item in between_9_and_3:
print item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment