Python set.issubset() Method

Beginner
6 min read
Updated: Nov 2026
3 examples
set method

Definition

issubset(other) returns True when every item of the set is also found in other, and False if even one item is missing. Neither collection is changed.

The two collections may be equal: a set is a subset of itself. The argument can be any iterable, but a set on the other side keeps the check fast.

set.issubset() is an instance method of the built-in set type: call it on a set with dot notation, such as required.issubset(...). No import is needed.

Syntax

Call it on the smaller group, pass the bigger one, and use the returned True or False.

python
is_inside = s.issubset(iterable)
is_inside = s <= other_set
is_proper = s < other_set
CallWhat it does
{1, 2}.issubset({1, 2, 3})Returns True: both 1 and 2 are in the argument.
{1, 4}.issubset([1, 2, 3])Returns False: 4 is not in the list.
set().issubset({1})Returns True: the empty set is a subset of every set.

a <= b is the operator form and needs sets on both sides. a < b asks for a proper subset, which also requires b to have at least one extra item. For the opposite direction, use issuperset().

Method signatures
python
set.issubset(other)
# returns: True if every item of the set is also in other, otherwise False
# raises: TypeError if other is not iterable

Parameters

ParameterDescription
otherAny iterable to look inside: set, list, tuple, string, range, and so on. It is required: issubset() with no argument raises TypeError.

Return Value

Return ValueDescription
boolTrue if every item of the set is in other (including when they are equal); False otherwise.

Python Examples

Example 1 — Check a Candidate Has All the Required Skills

Test whether the required skills fit inside what each candidate knows.

python
required = {"python", "sql"}
candidate = {"python", "sql", "git", "docker"}
intern = {"python", "html"}

print(required.issubset(candidate))
print(required.issubset(intern))
print(intern.issubset(candidate))

How It Works

  1. All requirements met. Python and SQL are both in the candidate's skills, so the answer is True.
  2. One is missing. The intern has Python but not SQL, so required.issubset(intern) is False.
  3. Direction matters. The intern's skills are not all in the candidate's set, because "html" is missing, so the last test is False as well.

Example 2 — Compare issubset() With<= and <

See how equal sets and a bigger set behave with the method and with both operators.

python
small = {1, 2}
same = {2, 1}
big = {1, 2, 3}

print(small.issubset(same), small <= same, small < same)
print(small.issubset(big), small <= big, small < big)
print(big.issubset(small))

How It Works

  1. Equal sets. A set is a subset of an equal set, so the method and <= are True, but < is False because there is no extra item.
  2. A real subset. The set {1, 2} fits inside {1, 2, 3} with one item to spare, so all three tests are True.
  3. The reverse is false. {1, 2, 3} has an item that {1, 2} lacks, so big.issubset(small) is False.

Example 3 — Validate Typed Letters Against an Alphabet

Use sets built from strings and pass a string or list straight to the method.

python
vowels = set("aeiou")
typed = set("eau")
other = set("easy")

print(typed.issubset(vowels))
print(other.issubset(vowels))
print({"a", "e"}.issubset("aeiou"))
print({"a", "z"}.issubset(["a", "e"]))

How It Works

  1. Letters become items. set("eau") holds e, a, and u, and all three are vowels, so the answer is True.
  2. Consonants break it. "easy" contains "s" and "y", which are not vowels, so the answer is False.
  3. A string as the argument. issubset("aeiou") loops over the letters of the string, so a set literal can be checked against it directly.
  4. A list as the argument. "z" is not in ["a", "e"], so the last test is False.

Frequently Asked Questions

True if every item of the set is also in the argument, and False if at least one item is missing. Equal sets count as subsets.
A subset may be equal to the other set. A proper subset must be smaller, so the other set has at least one extra item. Use < for a proper subset.
Yes. set().issubset(anything) is True because there is no item that could be missing.
Yes for two sets, but the <= operator needs sets on both sides. The method also accepts a list, tuple, or string as its argument.
Use issuperset(). a.issuperset(b) asks whether a contains every item of b, which is the same as b.issubset(a) when both are sets.

Next: set.issuperset()

Return True if the set contains every item of the other iterable.

issuperset() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful