Python Set issuperset()

The issuperset() method returns True if a set has every elements of another set (passed as an argument). If not, it returns False.

Set X is said to be the superset of set Y if all elements of Y are in X.

Superset of a Set
Superset of a Set

Here, set B is a superset of set A and A is a subset of set B.

The syntax of issuperset() is:


The following code checks if A is a superset of B.

Return Value from issuperset()

issuperset() returns

  • True if A is a superset of B
  • False if A is not a superset of B

Example: How issuperset() works?

A = {1, 2, 3, 4, 5}
B = {1, 2, 3}
C = {1, 2, 3}

# Returns True

# Returns False

# Returns True



If you need to check if a set is a subset of another set, you can use issubset() in Python.

Did you find this article helpful?