6.3 - Using map(), filter(), reduce()
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What does the map() function do?
💡 Hint: Think transformation or modification of a list.
How do you filter out odd numbers from a list using filter()?
💡 Hint: Look for the condition you need to check.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What is the output of list(map(lambda x: x + 3, [1, 2, 3]))?
💡 Hint: What happens when you add 3 to each number?
filter() returns all elements for which the provided function returns True.
💡 Hint: Think about the purpose of filtering elements.
2 more questions available
Challenge Problems
Push your limits with advanced challenges
Using map(), filter(), and reduce(), write a Python program that processes a list of temperatures in Celsius. Convert them to Fahrenheit, filter out the temperatures below freezing, and find the average of the remaining temperatures.
💡 Hint: Plant each step: convert, filter, then average!
Design a function that takes a list of strings, uses map() to find their lengths, filter() to remove strings shorter than 5 characters, and finally uses reduce() to concatenate the remaining strings.
💡 Hint: Focus on the sequence of operations and ensure each is appropriate for the next step.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.