SymPy | Polyhedron.size () in Python

Python Methods and Functions

Polyhedron.size (): size () — nice Python library function that returns the number of polyhedron corners.

Syntax: sympy.combinatorics.Polyhedrons.Polyhedron.size ()

Return: count of number of corners of the polyhedron

Code # 1: size () Example — tetrahedron

# Python code explaining
# SymPy.Polyhedron.size ()

 
# import SymPy libraries

from sympy.combinatorics import Permutation, Cycle

from sympy.combinatorics.polyhedron import tetrahedron, octahedron

 
# Use from
# sympy.combinatorics.polyhedron.Polyhedron.size ()

 
# Create polyhedron

a = tetrahedron.copy ()

 

print ( "Polyhedron - size form:" , a.size)

 

a.rotate ( 0 )

print ( "Polyhedron - size form:" , a.size)

Output:

Polyhedron - size form: 4

Polyhedron - size form: 4

Code # 2: size () Example — octahedron

# Python code explaining
# SymPy.Polyhedron.size ()

 
# import SymPy libraries

from sympy.combinatorics import Permutation, Cycle

from sympy.combinatorics.polyhedron import tetrahedron, octahedron

 
# Use from
# sympy.combinatorics.polyhedron.Polyhedron.size ()

 
# Create polyhedron  

a = octahedron.copy ()

 

print ( "Polyhedron - size form:" , a.size)

 

a.rotate ( 0 )

print ( " Polyhedron - size form: " , a.size)

Output:

Polyhedron - size form: 6

Polyhedron - size form: 6





Get Solution for free from DataCamp guru