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 Merge Two Dictionaries
Python List pop()
Python Program to Calculate the Area of a Triangle
Python issubclass()
Python Program to Convert Celsius To Fahrenheit
Python Program to Get the Class Name of an Instance
Python Machine Learning - Sebastian Raschka
Python Shallow Copy and Deep Copy
Python Program to Sort a Dictionary by Value
Python Closures
Python Set symmetric_difference_update()
Python strptime()
Python Program to Count the Number of Digits Present In a Number
Python Deep Learning - Valentino Zocca & Gianmario Spacagna & Daniel Slater & Peter Roelants
Python Program to Find the Factorial of a Number
Python Program to Check if a Key is Already Present in a Dictionary
Python max()
Python Program to Split a List Into Evenly Sized Chunks
Python hash()
How to Get Started With Python?
Python complex()
Python Deeper Insights into Machine Learning - Sebastian Raschka & David Julian & John Hearty
Python datetime
Python Dictionary update()
Python locals()
Python List reverse()
Python String lstrip()
Python Program to Find ASCII Value of Character
Python Program to Display Fibonacci Sequence Using Recursion
Python RegEx
Python Set add()
Python String format()