Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 23, 2020 03:34
Show Gist options
  • Save IndhumathyChelliah/c39ce37add52680d94945bcda195761a to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/c39ce37add52680d94945bcda195761a to your computer and use it in GitHub Desktop.
#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