Filtering Iterables With Python - Real Python
Filtering Iterables With Python
Negar Vahid 17 Lessons 1h 26m intermediate best-practices pythonPython's filter() is a built-in function that allows you to process an iterable and extract those items that satisfy a given condition. This process is commonly known as a filtering operation. With filter(), you can apply a filtering function to an iterable and produce a new iterable with the items that satisfy the condition at hand. In Python, filter() is one of the tools that you can use for functional programming .
In this video course, you'll learn how to:
- Use Python's
filter()in your code - Extract needed values from your iterables
- Combine
filter()with other functional tools - Replace
filter()with more Pythonic tools
With this knowledge, you'll be able to use filter() effectively in your code. Alternatively, you have the choice of using list comprehensions or generator expressions to write more Pythonic and readable code.
To better understand filter(), it would be helpful for you to have some previous knowledge on iterables , for loops , functions , and lambda functions . You can also refresh your memory of lambda functions through a video course .
What's Included:
- 17 Lessons
- Video Subtitles and Full Transcripts
- 2 Downloadable Resources
- Accompanying Text-Based Tutorial
- 4 Hands-On Coding Exercises
- Q&A With Python Experts: Ask a Question
- Certificate of Completion
Downloadable Resources:
Related Learning Paths:
Start NowGet Started With filter()
6 Lessons 27m
- 1. Filter Iterables With Python (Overview) 02:27
- 2. Understand the Concept of Filtering 02:35
- 3. Filter Iterables With filter() 05:39
- 4. Extract Even Numbers 04:13
- 5. Find Palindrome Strings 04:21
- 6. Exercise: Filter Palindromes With filter() 08:00
Use filter() for Functional Programming
7 Lessons 42m
- 1. Code With Functional Programming 03:52
- 2. Explore Lambda Functions 03:14
- 3. Combine filter() and map() 08:00
- 4. Combine filter() and reduce() 06:45
- 5. Exercise: Sum Even Squares With filter(), map(), and reduce() 08:00
- 6. Filter Iterables With filterfalse() 04:14
- 7. Exercise: Partition Values With filter() and filterfalse() 08:00
Code With Pythonic Style
4 Lessons 17m
- 1. Replace filter() With a List Comprehension 02:57
- 2. Extract Even Numbers With a Generator 04:58
- 3. Exercise: Refactor filter() and map() Into a Comprehension 08:00
- 4. Filter Iterables With Python (Summary) 01:34
About Negar Vahid
Negar works on AI Engineering at TraceAir, researches deep tech at Istanbul Technical University, and creates technical content for Real Python.
» More about NegarEach tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:
Christopher
Kate
Philipp
Tappan
Leodanis
David
Joanna
Aldren
Bartosz
Jacob