Practice Combining Map And Filter (25.1.5) - List Comprehension - Data Structures and Algorithms in Python
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

Combining map and filter

Practice - Combining map and filter

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

What does the map function do in Python?

💡 Hint: Think about how you can transform the contents of a list.

Question 2 Easy

Example: What will be the output of list(map(lambda x: x + 1, [1, 2, 3]))?

💡 Hint: What happens to each element when you add 1?

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What is the output of list(filter(lambda x: x >= 10, [5, 10, 15, 8]))?

[5
8]
[10
15]
[15]
[]

💡 Hint: Think about which numbers in the list are 10 or more.

Question 2

True or False: The map function returns a list in Python 3.

True
False

💡 Hint: Remember how Python 3 handles this compared to earlier versions.

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Write a function that returns all prime numbers less than 100 using filter and a prime checking function with list comprehension.

💡 Hint: Think about how to check for primality—what condition must be satisfied?

Challenge 2 Hard

Modify the Pythagorean triple generator to avoid generating duplicates. Ensure x < y < z.

💡 Hint: You need to adjust the ranges for y and z relative to x.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.