Python Set issuperset() Method Tutorial

In this section, we will learn what the Set issuperset() method is and how to use it in Python.

What is Set issuperset() Method in Python?

The Python Set issuperset() method is used to see if the entire elements of the specified Set object (the argument of the method) is also in the original Set (the Set object that invoked this method) or not.

Python Set issuperset() Method Syntax:

set.issuperset(Set)

Set issuperset() Method Parameter:

The method takes one argument and that is a reference to a Set object that we want to compare its elements with the original Set object.

Set issuperset() method Return Value

The return value of this method is of type Boolean.

The value True will return if the original Set object contained the entire elements of the reference Set object. Otherwise the value False will return instead.

Example: using python set issuperset() method

set1 = {1,2,3,4,5}

set2 = {1,2,3,4,5,500,600,700}

result = set2.issuperset(set1)

print(result)

Output:

True

Leave a Reply