issuperset() in Python
Python Set issuperset() method returns True if all elements of a set B are in set A. Then Set A is the superset of set B.
Python issuperset() Method Syntax:
Syntax: A.issuperset(B)
Parameter: Any other Set to compare with
Return: boolean value

Python issuperset() example
Example 1: Working of issubset() with two sets
Python3
A = {4, 1, 3, 5}B = {6, 0, 4, 1, 5, 0, 3, 5}print("A.issuperset(B) : ", A.issuperset(B))print("B.issuperset(A) : ", B.issuperset(A)) |
Output:
A.issuperset(B) : False B.issuperset(A) : True
Example 2: Working of Python issubset() Method with three Sets
Here we have use 3 different Sets to demonstrate the working of Python Set issubset() Method
Python
A = {1, 2, 3}B = {1, 2, 3, 4, 5}C = {1, 2, 4, 5}print("A.issuperset(B) : ", A.issuperset(B))print("B.issuperset(A) : ", B.issuperset(A))print("A.issuperset(C) : ", A.issuperset(C))print("C.issuperset(B) : ", C.issuperset(B)) |
Output:
A.issuperset(B) : False B.issuperset(A) : True A.issuperset(C) : False C.issuperset(B) : False
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!


Please Login to comment...