Free cookie consent management tool by TermsFeed Python Set - issubset method | Pythontic.com

Python Set - issubset method

Method signature:

issubset(anotherSetObject_in)

Overview:

  • The issubset() method determines whether the set is a subset of another set passed as the parameter. 

Parameters:

anotherSetObject_in : a Python set object.

Return Value:

True: When every element in the set is also present in anotherSetObject_in. 

False: When every element in the set is not present in anotherSetObject_in. 

Example:

# Example Python program that finds whether 
# a set is a subset of another given set

computerSciencePapers = {"Operating System Design", "Compiler Design","Programming Languages"}
mechanicalEngineeringPapers  = {"IC Engine Design", "Workshop Management"}
result = computerSciencePapers.issubset(mechanicalEngineeringPapers)
print(result)

Output:

False

 


Copyright 2025 © pythontic.com