Wednesday, July 3, 2024
HomeLanguagesPythonPython | sympy.combinatorics.Subset().cardinality method

Python | sympy.combinatorics.Subset().cardinality method

With the help of sympy.combinatorics.Subset().cardinality method, we can find the total cardinality of subsets by using sympy.combinatorics.Subset().cardinality method.

Syntax : sympy.combinatorics.Subset().cardinality
Return : Return the total cardinality of subset.

Example #1 :
In this example we can see that by using sympy.combinatorics.Subset().cardinality method, we are able to get the total cardinality of subset.




# import sympy and subset
from sympy.combinatorics.subsets import Subset
      
# Using sympy.combinatorics.Subset().cardinality method
gfg = Subset(['c', 'e'], ['a', 'b', 'c', 'e'])
    
print(gfg.cardinality)


Output :

16

Example #2 :




# import sympy and subset
from sympy.combinatorics.subsets import Subset
      
# Using sympy.combinatorics.Subset().cardinality method
gfg = Subset(['c', 'e', 'f'], ['a', 'f', 'c', 'e'])
    
print(gfg.cardinality)


Output :

16

Thapelo Manthata
I’m a desktop support specialist transitioning into a SharePoint developer role by day and Software Engineering student by night. My superpowers include customer service, coding, the Microsoft office 365 suite including SharePoint and power platform.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments