1. Overview
The issuperset() method returns True if a set has every elements of another set (passed as an argument). If not, it returns False.
Set X is said to be the superset of set Y if all elements of Y are in X.

Here, set B is a superset of set A and A is a subset of set B.
The syntax of issuperset() is:
A.issuperset(B)
The following code checks if A is a superset of B.
2. Return Value from issuperset()
issuperset() returns
- True if A is a superset of B
- False if A is not a superset of B
3. Example: How issuperset() works?
A = {1, 2, 3, 4, 5}
B = {1, 2, 3}
C = {1, 2, 3}
# Returns True
print(A.issuperset(B))
# Returns False
print(B.issuperset(A))
# Returns True
print(C.issuperset(B))
Output
True False True
If you need to check if a set is a subset of another set, you can useĀ issubset() in Python.
Related posts:
Python ord()
Node.js vs Python for Backend Development
Python Tuple index()
Python Program to Check if a Number is Positive, Negative or 0
Python String rfind()
Python Namespace and Scope
Python @property decorator
Python Program to Create a Countdown Timer
Python List Comprehension
Python String casefold()
Python Program to Merge Mails
Python id()
Python Program to Get File Creation and Modification Date
Building Chatbots with Python Using Natural Language Processing and Machine Learning - Sumit Raj
Python Program to Measure the Elapsed Time in Python
Python max()
Python object()
Python Dictionary get()
Python Program to Count the Number of Each Vowel
Python Program to Check Leap Year
Python Dictionary values()
Convert a Map to an Array, List or Set in Java
Python Function Arguments
Python dir()
Python Machine Learning - Sebastian Raschka
Python Program to Swap Two Variables
Python Set copy()
Python Variables, Constants and Literals
Python Directory and Files Management
Python slice()
Python Program to Print Output Without a Newline
Python hex()