A lot of the usefulness of a set container comes from the set operations. These allow you to combine sets, find the difference and intersections of sets, and more! You can combine these operations to perform complex logic problems on multiple sets. This can be useful for filtering items, categorizing, combining, as well as many other uses.
The operations which we will be looking at are:
- Intersections (and Intersection Updates)
- Differences (and Difference Updates)
- Symmetric Differences (and Symmetric Difference Updates)
Additional operations will not be covered in this lesson, such as finding subsets and supersets. Information about these operations can be found in the Python documentation.
Look over the venn diagrams for different set operations using a set
A and set
B. We will be covering all four in the next exercises!