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 Decorators
Python max()
Python Program to Differentiate Between type() and isinstance()
Python memoryview()
Python if...else Statement
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python Set symmetric_difference()
Python Program to Print Output Without a Newline
Python Program to Check Whether a String is Palindrome or Not
Python Set union()
Python str()
Python Program to Check If a List is Empty
Python String zfill()
Python List extend()
Python Program to Find the Size (Resolution) of a Image
Python Program to Get Line Count of a File
Python Program to Solve Quadratic Equation
Python Namespace and Scope
Python Program to Print Colored Text to the Terminal
Python Program to Get the Full Path of the Current Working Directory
Python String replace()
Python Program to Slice Lists
Python Program to Find Factorial of Number Using Recursion
Python dir()
Python Program to Count the Number of Each Vowel
Python List pop()
Python String rsplit()
Python String isspace()
Python Program to Find Numbers Divisible by Another Number
Python Program to Print all Prime Numbers in an Interval
Python Program to Represent enum
Python Program to Check the File Size