Determines whether all items in the specified set are present in the original set
Usage
The issuperset()
method returns True if all items in the specified set are present in the original set, otherwise FALSE.
Syntax
set.issuperset(set)
Parameter | Condition | Description |
set | Required | A set to search for common items in |
Basic Example
# Check if all items in B are present in A
A = {'red', 'green', 'blue', 'yellow'}
B = {'yellow', 'red'}
print(A.issuperset(B))
# Prints True

Equivalent Operator >=
You can achieve the same result by using the >=
comparison operator.
A = {'red', 'green', 'blue', 'yellow'}
B = {'yellow', 'red'}
print(A >= B)
# Prints True
Find Proper Superset
To test whether the set is a proper superset of other, use >
comparison operator.
Set A is considered a proper superset of B, if A is a superset of B, but A is not equal to B.
# Check if A is a proper superset of B
A = {'red', 'green', 'blue', 'yellow'}
B = {'yellow', 'red'}
print(A > B)
# Prints True
# Check if A is a proper superset of B
A = {'yellow', 'red'}
B = {'yellow', 'red'}
print(A > B)
# Prints False