Skip to content
Set Methods

issubset()

Report whether another set contains this set.

set.issubset(other)

set.issubset() checks whether every element in the calling set is present in other.

Equivalent to the <= subset operator.

Parameters

NameDescription
otherAn iterable to test against.

Returns

True if this set is a subset; otherwise False.

Try it

Run it and change it
vowels = {"a", "e", "i", "o", "u"}
alphabet = set("abcdefghijklmnopqrstuvwxyz")
print(vowels.issubset(alphabet))

Worth knowing

  • Proper subset: The method tests subset (<=). To test strict proper subset (must be strictly smaller), use the < operator.

Related entries