35 Working with Set
After reading this lesson, you will be able to:
- Perform union, intersection, and difference operations on sets.
- Inquire about the properties of a set
- Select one of its elements based on its features
- Filter its items according to their characteristics
In the previous lesson, you have learned about the structure of a set and how to transform its elements. In this lesson, you are going to discover other methods that the class Set has to offer. You’ll apply the operations of union, intersection, and difference on two sets. Then, I’ll introduce you to more complex transformations you can do on them: you’ll notice a lot of overlap with the concepts that you have discovered for the List collection in unit 5. You’ll inquire about the properties of a set, such as its size or the presence of an item. You will select one of its elements based on its characteristics, and determine its minimum and maximum. You’ll filter its values based on their features. In the capstone, you are going to use these operations to analyze the book loans of your library.