0% found this document useful (0 votes)
11 views

Lecture 6.5 - Python Map Function

The document discusses the Python map function, defining it as executing a specified function for each item in an iterable. It provides the syntax as map(function, iterables), describes using map to apply a function to each piece of data in a collection, and notes map returns a map object.

Uploaded by

didarulislam2460
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Lecture 6.5 - Python Map Function

The document discusses the Python map function, defining it as executing a specified function for each item in an iterable. It provides the syntax as map(function, iterables), describes using map to apply a function to each piece of data in a collection, and notes map returns a map object.

Uploaded by

didarulislam2460
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Lecture-6.

5
Python Map Function
Content

● Definition
● Syntax
● Area of use
● Working with Map

sazzad@diucse
Definition

● The map() function executes a specified function for each


item in an iterable. The item is sent to the function as a
parameter.
● Make an iterator that computes the function using
arguments from each of the iterables.

sazzad@diucse
Syntax

map(function, iterables)
Parameter Values
Parameter Description
function Required. The function to execute for each item
iterable Required. A sequence, collection or an iterator object. You can
send as many iterables as you like, just make sure the function has
one parameter for each iterable.

sazzad@diucse
Area to Use Map
● The general way that the map function works. Suppose you
have a list, tuple to other itrable collection of data, and we
would like to apply the function f to each piece of data.
data: 𝑎1 ,𝑎2 ….., 𝑎𝑛
faction: 𝑓
map(𝑓 ,data)
● With the map function, you first specify the function, then
you specify the data the iterate over. The map function will
return an iterator over the collation of f applied to each piece
of data
sazzad@diucse
Working with Map
● map(func, *iterables) --> map object

Output

sazzad@diucse
Thank You

sazzad@diucse

You might also like