Last Updated : 17 Aug, 2022
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:Python issuperset() example Example 1: Working of issubset() with two sets Python3Syntax: A.issuperset(B)
Parameter: Any other Set to compare with
Return: boolean value
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) : TrueExample 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4