+

SymPy | Partition.as_ferrers () in Python

Partition.as_ferrers (): as_ferrers () — nice Python library function that returns a section partition diagram according to the specified symbol.

Syntax: sympy.combinatorics.partitions.Partition.as_ferrers (char)

Return: ferrer diagram of a partition

Code # 1: as_ferrers () example

# Python code explaining
# SymPy.as_ferrers ()

 
# import SymPy libraries

from sympy.combinatorics.partitions import Partition

from sympy.combinatorics.partitions import IntegerPartition

 
# Using the sympy.combinatorics.partitions.Partition.as_ferrers () method

print (IntegerPartition ([ 5 , 2 , 5 ]). as_ferrers ())

Quit:

#####
#####
##

Code # 2: as_ferrers example (char = & # 39; * & # 39;)

# Python code explaining
# SymPy.as_ferrers ()

  
# import SymPy libraries

from sympy.combinatorics.partitions import Partition

from sympy.combinatorics.partitions import IntegerPartition

 
# Using the sympy.combinatorics.partitions.Partition.as_ferrers () method

print (IntegerPartition ([ 1 , 2 , 3 , 4 ]). As_ferrers (char = `*` ))

Output:

****
***
**
*

Get Solution for free from DataCamp guru