-
-
Save IndhumathyChelliah/5bcc494865503536a045ce2ce18cd0a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Using map() function | |
l1=map(lambda x:x*x,range(1,11)) | |
#Returns an iterator(map object) | |
print (l1)#Output:<map object at 0x00C0EC10> | |
print (list(l1))#Output:[1, 4, 9, 16, 25, 36, 49, 64, 81, 100] | |
#Using List Comprehension | |
l2=[x*x for x in range(1,11)] | |
print (l2)#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