Avec la méthode sympy.combinatorics.partitions.Partition()
nous allons diviser les éléments du tableau en un seul tuple en utilisant sympy.combinatorics.partitions .Partition ( )
.
Syntaxe :
sympy.combinatorics.partitions.Partition(array)
Retour : Renvoie les membres d`un tableau dans un seul tuple.
Exemple n° 1 :
Dans cet exemple, nous voyez qu`en utilisant sympy.combinatorics.partitions.Partition ()
nous pouvons obtenir des membres de différents tableaux.
# import sympy et relationnel
depuis
sympy.combinatorics. partitions
import
Partition
de
sympy
import
*
x, y
=
symboles (
`xy`
)
# Utilisation de la méthode sympy.combinatorics.partitions.Partition()
gfg
=
Partition ([
1
,
2
], [
4
,
5
,
6
], [
-
12
,
-
11
])
print
(gfg.members)
Quitter :
(-12, -11, 1, 2, 4, 5 , 6)
Exemple # 2 :
# import sympy et Relationnel
de
sympy.combinatorics.partitions
importer
Partition
de
sympy
importer
*
x, y
=
symboles (
` xy`
)
# Utilisation de la méthode sympy.combinatorics.partitions.Partition ()
gfg
=
Partition ([
3
], [
1
,
91
], [
2
], [
6
])
print
(gfg.members)
Sortie :
(1, 2, 3, 6, 91 )