Created
July 21, 2018 19:50
-
-
Save vinaykudari/fa5c526d0f04bbcb540a2fa131377906 to your computer and use it in GitHub Desktop.
Map function
This file contains hidden or 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
list_a = [1, 2] | |
list_b = [10, 20] | |
def add(a,b): | |
return a+b | |
m1 = map(add,list_a,list_b) #using normal function | |
m2 = map(lambda x, y: x + y, list_a, list_b) #using lambda function | |
>> print(list(m1)) | |
[11,22] | |
>> print(list(m2)) | |
[11,22] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment