Python Set issuperset() Method
Description
The issuperset() method determines whether all elements of a specified set are contained in the original set, returning True if so and False otherwise.
Syntax
Syntax of the issuperset() method:
set.issuperset(set)
Parameters
- set -- required, the set to look up in
Return Value
Returns a Boolean; True if all are contained, otherwise False.
Example
Determine whether all elements of set y are contained in set x:
Example 1
x
= {
"
f
"
,
"
e
"
,
"
d
"
,
"
c
"
,
"
b
"
,
"
a
"
}
y
= {
"
a
"
,
"
b
"
,
"
c
"
}
z
=
x
.
issuperset
(
y
)
(
z
)
The output is:
True
Returns False if not all are contained:
Example 1
x
= {
"
f
"
,
"
e
"
,
"
d
"
,
"
c
"
,
"
b
"
}
y
= {
"
a
"
,
"
b
"
,
"
c
"
}
z
=
x
.
issuperset
(
y
)
(
z
)
The output is:
False
Python Sets