Skip to content

Instantly share code, notes, and snippets.

/gist:2434554

Created Apr 21, 2012
Embed
What would you like to do?
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