📜  SymPy | Python中的 Prufer.size()

📅  最后修改于: 2022-05-13 01:54:33.278000             🧑  作者: Mango

SymPy | Python中的 Prufer.size()

Prufer.size() : size()是一个 sympy Python库函数,它返回 Prufer 序列的大小。

代码 #1:size() 示例

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

输出 :

代码 #2:size() 示例

# Python code explaining
# SymPy.Prufer.size()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
  
# Using from 
# sympy.combinatorics.prufer.Prufer.size()
  
# Creating Prufer
b = Prufer([1, 2, 3, 2, 4, 5], [6, 7], [8])
  
# size value
print ("Prufer b size : ", b.size)

输出 :