Easy Tutorial
❮ Ref Math Fmod Python List Operator ❯

Python Set issuperset() Method

Python Set


Description

The issuperset() method is used to determine if all elements of a specified set are contained in the original set. It returns True if they are, otherwise it returns False.

Syntax

The syntax for the issuperset() method is:

set.issuperset(set)

Parameters

Return Value

Returns a Boolean value, True if all elements are included, otherwise False.

Example

Determine if 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)

print(z)

Output:

True

If not all elements are included, it returns False:

Example 2

x = {"f", "e", "d", "c", "b"}
y = {"a", "b", "c"}

z = x.issuperset(y)

print(z)

Output:

False

Python Set

❮ Ref Math Fmod Python List Operator ❯