- issuperset() is a python function which is only applicable on sets data type.
- it compare two sets and check whether one set is superset of another set or not.
- superset() and issuperset() both are of complimentry nature.
Syntax-
set1.issuperset(set2)
- It will return True, if set2 is superset of set1, i.e. set1 is subset of set2.
- It will return False, if set2 is not superset of set1.
Example
set1 is {1,2}
set2 is {1,2,3,4}
set2.issuperset(set1) will give True
set1.issuperset(set2) will give False.
program-
set1={1,2,3,4}
set2={1,2,3,4,5,6,7,8,9}
print("Set1 is",set1)
print("Set2 is",set2)
print(set1.issuperset(set2))
print(set2.issuperset(set1))
Set1 is {1, 2, 3, 4}
Set2 is {1, 2, 3, 4, 5, 6, 7, 8, 9}
False
True