Skip to content

Instantly share code, notes, and snippets.

Created Jul 5, 2020
What would you like to do?
import itertools
#lambda function and itertools.count() is given as argument in map()function.
l1=map(lambda x:x**2,itertools.count())
#It returns a map object which is an iterator.
print(l1)#Output:<map object at 0x00E2E610>
#iterate thorugh map object using for loop
for i in l1:
if i>50:
print (i ,end=" ")#Output:0 1 4 9 16 25 36 49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment