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 Program to Check If Two Strings are Anagram
Python Program to Parse a String to a Float or Int
Python exec()
Python dict()
Python Program to Access Index of a List Using for Loop
Python Program to Get the Last Element of the List
Python String rpartition()
Python Program to Generate a Random Number
Python min()
Python Program to Trim Whitespace From a String
Python Program to Create Pyramid Patterns
Python Program to Check if a Number is Odd or Even
Python for Loop
Python next()
Python 3 for Absolute Beginners - Tim Hall & J.P Stacey
Python Program to Create a Long Multiline String
Python Set intersection_update()
Python Program to Measure the Elapsed Time in Python
Python Statement, Indentation and Comments
Python Program to Make a Simple Calculator
Python int()
Python Program to Get the Full Path of the Current Working Directory
Python chr()
Python String islower()
Python format()
Python Custom Exceptions
Python String lstrip()
Python Shallow Copy and Deep Copy
Python Operator Overloading
Python Program to Shuffle Deck of Cards
Python set()
Python String swapcase()