SymPy | Permutation.size() in Python
Permutation.size(): size() ist eine sympy Python-Bibliotheksfunktion, die die Anzahl der Elemente in der Permutation zurückgibt.
Syntax: sympy.combinatorics.permutations.Permutation.size()
Rückgabe: Anzahl der Elemente in der Permutation.
Code # 1: size() Beispiel
from
sympy.combinatorics.partitions
import
Partition
from
sympy.combinatorics.permutations
import
Permutation
a
=
Permutation([[
2
,
0
], [
3
,
1
]])
b
=
Permutation([
1
,
3
,
5
,
4
,
2
,
0
])
(
"Permutation a - size form : "
, a.size)
(
"Permutation b - size form : "
, b.size)
Ausgabe :
Permutation a - Größenform: 4
Permutation b - Größenform: 6
Code # 2: size() Beispiel
from
sympy.combinatorics.partitions
import
Partition
from
sympy.combinatorics.permutations
import
Permutation
a
=
Permutation([[
2
,
4
,
0
],
[
3
,
1
,
2
],
[
1
,
5
,
6
]])
(
"Permutation a - size form : "
, a.size)
Ausgabe :
Permutation a - Größenform: 7