Python Collection 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)

Run Instance

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. To retrieve the set of equal items in it.

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)

Run Instance