Home >>Python Set Methods >Python Set issubset() Method

Python Set issubset() Method

Python Set issubset() Method

Python Set issubset() Method in python set returns boolean true if all elements in the set are present in another set and returns false if all elements not present.

Syntax:
set.issubset(set)

Parameter Values

Parameter Description
set It is Required. The set of items to be search for
Here is an example of Python Set issubset() Method:

a = {"ab", "bc", "cd"}
b = {"fg", "ef", "de", "cd", "bc", "ab"}
c = a.issubset(b) 
print(c)

Output:
True
Example 2:

x = {21, 27, 39} 
y = {21, 27, 39, 43, 50} 
z = {21, 27, 43, 50} 
print(x.issubset(y)) 
print(y.issubset(x)) 
print(x.issubset(z)) 
print(z.issubset(y))

Output:
True

Popular Tutorials