31 Working with List: Filtering

 

After reading this lesson, you will be able to

  • Remove or select items from a sequence based on their position
  • Filter elements of a list that respect a given predicate
  • Remove duplicated items in a sequence

In the previous lesson, you learned how to select a single element in a sequence based on its position or features. In this lesson, you’ll continue to discover other operations you can perform on an instance of List. You’ll see how to create a new list from an existing one by selecting one of its subsections. You’ll discover how to pick elements that have specific characteristics. Finally, you’ll learn how to create a new sequence that contains no duplicated items. In the capstone, you’ll use these operations to create a subset of movies that have specific characters.

31.1 Dropping and taking elements

In the previous lessons, you developed a program to store your contacts. Let’s recall that your program represents a contact record.

31.2 Filtering Items of a list

 
 
 
 

31.3 Removing duplicates

 
 
 
 

Summary

 
 

Answers to quick checks

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest