Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
More than just a friend of Dora or a way to find things, `map()` lets us apply transformations to each item in an iterable.
map()
takes a function and an iterable. The function should take a single argument. This function will be applied, in order, to each item in the iterable and the result of that function will be returned to map()
. In the end, map()
will return a new iterable with the mutated values.
[func(item) for item in iterable]
achieves the same result, plus turns the results into a list. For simple, single-serving applications, this is often a better choice since it's often more readable at a glance.
Watch our comprehensions workshop if you want more information.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Laurens Sandt
3,513 PointsSolved accepted solution to challenge wont run in PyCharm
Posted by Laurens SandtLaurens Sandt
3,513 Points1 Answer
-
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsWhy does this function succeed in not modifying the original?
1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up