A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/python/issuperset-in-python/ below:

issuperset() in Python - GeeksforGeeks

issuperset() in Python

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:

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


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