Map: Implementing map reduce with lambda functions (python)
The map function makes a transformation of each element of an array to a correspondent element in a new list that will be produced as output. The transformation of each element is handled by a function that is parametrized in the map function call.
In this
example below the function to perform the transformation is defined using the
lambda syntax.
names = ["Peter Parker", "Tony Stark", "Natasha Romanova"]
# Using lambda function
namesFormatted = list(map(lambda el:
el.upper(), names))
https://github.com/rafaelqg/code/blob/main/map_lambda.py
You may see
a video class about this video here:
Comments
Post a Comment