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 Randomly Select an Element From the List
Python Set difference()
Python Program to Differentiate Between type() and isinstance()
Python Numbers, Type Conversion and Mathematics
Python List copy()
Python id()
Python Machine Learning Eqution Reference - Sebastian Raschka
Python hasattr()
Python float()
Python Program to Check the File Size
Python timestamp to datetime and vice-versa
How to get current date and time in Python?
Python int()
Python Decorators
Python Program to Display the multiplication Table
Python Program to Check if a Number is Odd or Even
Python *args and **kwargs
Python classmethod()
Convert a Map to an Array, List or Set in Java
Python Program to Create a Long Multiline String
Python String rstrip()
Python Program to Get File Creation and Modification Date
Python range()
Python Closures
Python Program to Find the Factors of a Number
Python Program to Compute all the Permutation of the String
Python Machine Learning Second Edition - Sebastian Raschka & Vahid Mirjalili
Python super()
Python delattr()
Python Operators
Python Program to Check If a String Is a Number (Float)
Python frozenset()