Friday, September 5, 2025
HomeLanguagesPython | sympy Partition() method

Python | sympy Partition() method

With the help of sympy.combinatorics.partitions.Partition() method, we are going to separate the members of arrays into one tuple by using sympy.combinatorics.partitions.Partition() method.

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

Return : Return a members of arrays into one tuple.

Example #1 :
In this example we can see that by using sympy.combinatorics.partitions.Partition() method, we are able to get the members of different arrays.




# import sympy and Relational
from sympy.combinatorics.partitions import Partition
from sympy import * 
  
x, y = symbols('x y')
  
# Using from sympy.combinatorics.partitions.Partition() method
gfg = Partition([1, 2], [4, 5, 6], [-12, -11])
  
print(gfg.members)


Output :

(-12, -11, 1, 2, 4, 5, 6)

Example #2 :




# import sympy and Relational
from sympy.combinatorics.partitions import Partition
from sympy import * 
  
x, y = symbols('x y')
  
# Using from sympy.combinatorics.partitions.Partition() method
gfg = Partition([3], [1, 91], [2], [6])
  
print(gfg.members)


Output :

(1, 2, 3, 6, 91)

Last Updated :
13 Aug, 2019
Like Article
Save Article

<!–

–>

Similar Reads
Related Tutorials
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11863 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6701 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS