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