Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 23, 2020 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/fd88a87b68615f11f42f268f39ded671 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/fd88a87b68615f11f42f268f39ded671 to your computer and use it in GitHub Desktop.
#Using map() function
l1=map(lambda x:x*x,range(1,11))
#Returns an iterator(map object)
print (l1)#Output:<map object at 0x00C0EC10>
#Converting iterator into list using list() constructor.
print (list(l1))#Output:[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment