Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

Python's map() Function: Transforming Iterables (Summary)

In this course, you’ve learned how map() works and how to use it to process iterables. You also learned about some Pythonic tools that you can use to replace map() in your code.

You now know how to:

  • Work with Python’s map()
  • Use map() to process and transform iterables without using an explicit loop
  • Combine map() with functions like filter() and reduce() to perform complex transformations
  • Replace map() with tools like list comprehensions and generator expressions
Download

Sample Code (.zip)

5.2 KB
Download

Course Slides (.pdf)

2.1 MB

00:00 All right! Well, we’ve come to the end of the course, so why don’t we summarize what you’ve learned?

00:06 I hope that you got a good understanding of how to use the map() function and when to use it. Perhaps now, every now and then, instead of using a for loop or maybe even a list comprehension, you go ahead and use the map() function!

00:20 You might actually like it. Then we talked about combining the map() function with the filter() function and the reduce() function, which are just some extra tools for you to use when you’re working with iterators. And then it was nice to know about the starmap() function.

00:37 You know, sometimes you’re working with data and the data comes to you zipped up already, and instead of sort of breaking that data up, if you just want to map a function, then with this combined data you can use the starmap() function.

00:52 These functions that we learned about fall into this general idea of using a more functional programming approach to your code. It’s a good idea to mix things up and help you think about code in a different way. That being said, there are some nice Pythonic alternatives to the map() function and the reduce() function and the filter() function. So again, it’s good to know about these things.

01:16 You might see this in other people’s code and you just want to know about them. It doesn’t hurt to know these general ideas.

01:26 Well, that just about wraps things up with the course. Thank you for watching and I hope that you learned something!

Maram-dev on May 6, 2021

Thank you for a great course!

Cesar Aguilar RP Team on May 7, 2021

Thank you! Glad you enjoyed it.

mikaliae on June 7, 2021

Got many good ideas about how to solve a specific problem. Nice usage of built-in and library functions. Liked also the caesar cipher example. Thanks!

subinmath on Sept. 11, 2021

This was really great. Thanks!

aniketbarphe on Oct. 3, 2021

Thank You for valuable session!

Shubha on Nov. 2, 2021

Great Course, thank you!

Become a Member to join the conversation.