set.issubset() Subset?
Last updated: 2026-09-22
set.issubset() Subset?
set.issubset(other) returns True if every element of set is in other.
| Category | Set Methods |
|---|---|
| Kind | Built-in Type Method |
| Python Version | all |
📝 Syntax
set.issubset(other)
⚙️ Parameters
| other Required | The iterable to test against (the superset). |
|---|
Returns:bool, True if every element of set is in other.
Mutates the original:No (returns a new object)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
True
False
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhat does issubset() check?
AWhether the current set is a subset of other (every element of it is in other). {1, 2}.issubset({1, 2, 3}) returns True.
QIs an empty set a subset of every set?
AYes; set().issubset({1}) returns True.
QIs a set a subset of itself?
AYes; {1, 2}.issubset({1, 2}) returns True. To test a proper subset use the < operator.
QWhat is the difference from the <= operator?
AEssentially equivalent: a.issubset(b) is like a <= b. For a proper subset use a < b.