# SymPy | Subset.size() in Python

Subset.size() : size() is a sympy Python library function that returns the size of the subset.

Syntax :
sympy.combinatorics.subset.Subset.size()

Return :
the size of the subset.

Code #1 : size() Example

 `# Python code explaining ` `# SymPy.Subset.size() ` ` `  `# importing SymPy libraries ` `from` `sympy.combinatorics ``import` `Permutation, Cycle ` `from` `sympy.combinatorics.subsets ``import` `Subset ` ` `  `# Using from  ` `# sympy.combinatorics.subset.Subsets.size() ` ` `  `# Creating Subset ` `a ``=` `Subset([``'c'``, ``'d'``], [``'geek'``, ``'for'``, ``'c'``, ``'d'``]) ` ` `  `# size value ` `print` `(``"Subset a size : "``, a.size) `

Output :

Subset a size : 2

Code #2 : size() Example

 `# Python code explaining ` `# SymPy.Subset.size() ` ` `  `# importing SymPy libraries ` `from` `sympy.combinatorics ``import` `Permutation, Cycle ` `from` `sympy.combinatorics.subsets ``import` `Subset ` ` `  `# Using from  ` `# sympy.combinatorics.subset.Subsets.size() ` ` `  `# Creating Subset ` `a ``=` `Subset([``2``, ``3``, ``4``], [``1``, ``2``, ``3``, ``4``, ``5``]) ` ` `  `# size value ` `print` `(``"Subset a size : "``, a.size) `

Output :

Subset a size : 3

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!

Previous
Next