Home >>Python Set Methods >Python Set issuperset() Method

Python Set issuperset() Method

Python Set issuperset() Method

Python Set issuperset() Method in python set is used to returns true if all elements of set 2 present in the set1 which is passed as a argument, otherwise it returns false.

Syntax:
set.issuperset(set)

Parameter Values

Parameter Description
set It is Required. The set of equal items to be searched for
Here is an example of Python Set issuperset() Method:

a = {"12", "32", "42", "52", "62", "72"}
b = {"52", "32", "12"}
c = a.issuperset(b) 
print(c)

Output:
True
Example 2:

x = {65, 23, 45, 5} 
y = {45, 20, 65, 23, 15, 5, 45, 5} 
print("x.issuperset(y) : ", x.issuperset(y)) 
print("y.issuperset(x) : ", y.issuperset(x))

Output:
x.issuperset(y) : False
y.issuperset(x) : True

Popular Tutorials