Python issuperset

Summary: in this tutorial, you’ll learn how to use the Python issuperset() method to check if a set is a superset of another.

Introduction to Python issuperset method #

Suppose that you have two sets: A and B. A is a superset of B if all elements of B are elements of A.

If A is a superset of B, then B is a subset of A. To check if a set is a subset of another, you use the issubset() method.

If set A and set B are not equal, set A is a proper superset of set B.

Logically, a set is a superset of itself.

The following illustrates that set A is the superset of the set B because the elements 1, 2, 3 in the set B are also in set A: