Skip to content

Instantly share code, notes, and snippets.

Created Jul 23, 2020
What would you like to do?
#Using filter function
evennumber=filter(lambda x: x%2==0,range(1,11))
#filter() returns an iterator.
print (evennumber) #Output:<filter object at 0x0144EC10>
#Iterating through iterator using for loop
for i in evennumber:
print (i,end=" ")
#Output:2 4 6 8 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment