issperset () in Python

Python Methods and Functions

Syntax :

 A.issuperset (B) checks whether A is a superset of B or not. 

Returns:

 True if A is a superset of B; otherwise false. 

Code 1:

# Python program to demonstrate how it works
# issperset ().

 

A = { 4 , 1 , 3 , 5 }

B = { 6 , 0 , 4 , < code class = "value"> 1 , 5 , 0 , 3 , 5 }

 

print ( "A.issuperset (B):" , A.issuperset (B))

 
# B is a superset of A

print ( "B.issuperset (A):" , B.issuperset (A))

Exit:

 A.issuperset (B): False B.issuperset ( A): True 

Code 2:

# Python demonstration program
# Issueperset ().

  

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