Skip to content

Instantly share code, notes, and snippets.

Created Jul 5, 2020
What would you like to do?
import itertools
#Only returns element whose corresponding selector is True.
print (list(l1))#Output:[1,3]
#filter - instead of passing an iterable of True and False. function is used to determine the value "True or False"
l2=filter(lambda x:x%2!=0,[1,2,3,4])
print (list(l2))#Output:[1,3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment