filter() allows you to perform filtering operations on iterables. This kind of operation consists of applying a Boolean function to the items in an iterable and keeping only those values for which the function returns a true result. In general, you can use
filter() to process existing iterables and produce new iterables containing the values that you currently need.
In this video course, you learned how to:
- Work with Python’s
filter()to process iterables and keep the values you need
reduce()to approach different problems
filter()with list comprehensions and generator expressions
With this new knowledge, you can now use
filter() in your code to give it a functional style. You can also switch to a more Pythonic style and replace
filter() with list comprehensions or generator expressions.
For further investigation, check out:
- 📰 Iterators and Iterables in Python: Run Efficient Iterations
- 📰 How to Use Python Lambda Functions
- 🎬 How to Use Python Lambda Functions
- 📰 How to Use Generators and
- 🎬 Python Generators 101
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.