Python Set issuperset() Method
Example
If all items in the set y exist in the set x, then return True:
x = {"f", "e", "d", "c", "b", "a"} y = {"a", "b", "c"} z = x.issuperset(y) print(z)
Definition and Usage
If all items in the specified set exist in the original set, the issuperset() method will return True, otherwise it will return False.
Syntax
set.issuperset(set)
Parameter Value
Parameter | Description |
---|---|
set | Required. The set in which to retrieve the equal items. |
More Examples
Example
What if not all items exist in the specified set?
If not all items in the set y exist in the set x, then return False:
x = {"f", "e", "d", "c", "b"} y = {"a", "b", "c"} z = x.issuperset(y) print(z)