Python Programming Training Certification
Flexible Hours
100 Assignments
Instructor Led online Training
50 LMS Access
24X7 Support
100% Skill Level
Enquire Now
Course Overview
Python map() Function
The python map() function is used to return a list of results after applying a given function to each item of an iterable(list, tuple etc.)
Signature
- map(function, iterables)
Parameters
function– It is a function in which a map passes each item of the iterable.
iterables– It is a sequence, collection or an iterator object which is to be mapped.
Return
It returns a list of results after applying a given function to each item of an iterable(list, tuple etc.)
Python map() Function Example 1
The below example shows the working of map().
-
def calculateAddition(n):
return n+nnumbers = (1, 2, 3, 4)
result = map(calculateAddition, numbers)
print(result)# converting map object to set
numbersAddition = set(result)
print(numbersAddition)
Output:
- <map object at 0x7fb04a6bec18>
{8, 2, 4, 6}
Explanation: In this example, it returns the list of results after applying a given function to each item of an iterable.
Python map() Function Example 2
The below example shows how to use lambda function with map().
-
numbers = (1, 2, 3, 4)
result = map(lambda x: x-x, numbers)
print(result)# converting map object to set
numbersSubtract = set(result)
print(numbersSubtract)
Output:
- <map 0x7f53009e7cf8>
{0}
Candidate’s Journey During Our Training Program
Expert’s Advice & Selection of Module
Choosing the right type of module for the training is half the battle & Our Team of experts will help & guide you.
Get Trained
Get Trained & Learn End to End Implementation from our Expert Trainer who are working on the same domain.
Work on Projects
We Do make our student’s work on multiple case studies , scenario based tasks & projects in order to provide real-time exposure to them.
Placements
We have a dedicated placement cell in order to provide placement assistance & relevant interviews to our candididates till selection
Placement Partner