Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Set issuperset() Method

Python Set issuperset() Method

Python3 Lists Python Sets


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

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

)

print

(

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

)

print

(

z

)

The output is:



False

Python3 Lists Python Sets