Learn

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:

  • Unions
  • 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.

Instructions

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!

Sign up to start coding

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?