# SymPy | Partition.RGS_rank() in Python

Partition.RGS_rank(rank, n) : RGS_rank() is a sympy Python library function that gives the rank for a restricted growth strings (string where a[i] is the block in which element i occurs) .

Restricted growth strings – string in which each character, ai results in the Block (Bi) in which the corresponding element belongs.

Syntax : sympy.combinatorics.partitions.Partition.RGS_rank()

Return : rank for restricted growth strings.

Code #1 : RGS_rank() Example

 `# Python code explaining ` `# SymPy.RGS_rank() ` ` `  `# importing SymPy libraries ` `from` `sympy.combinatorics.partitions ``import` `Partition ` `from` `sympy.combinatorics.partitions ``import` `RGS_rank ` ` `  `# Using from sympy.combinatorics.partitions.Partition.RGS_rank() method  ` `p ``=` `RGS_rank([``0``, ``0``, ``1``, ``1``, ``2``]) ` ` `  `print` `(``"rank for restricted growth string : \n"``, p) `

Output :

rank for restricted growth string :
10

Code #2 : RGS_rank() Example

 `# Python code explaining ` `# SymPy.RGS_rank() ` ` `  `# importing SymPy libraries ` `from` `sympy.combinatorics.partitions ``import` `Partition ` `from` `sympy.combinatorics.partitions ``import` `RGS_rank ` ` `  `# Using from sympy.combinatorics.partitions.Partition.RGS_rank() method  ` `p ``=` `RGS_rank( [``0``, ``0``, ``0``, ``0``, ``0``, ``1``, ``1``, ``1``, ``0``, ``1``]) ` ` `  `print` `(``"rank for restricted growth string : \n"``, p) `

Output :

rank for restricted growth string :
100

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.