SymPy | Permutation.parity() in Python Last Updated : 27 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report Permutation.parity() : parity() is a sympy Python library function that returns the parity of the permutation. It means the parity of the number of inversions in the permutation. Syntax : sympy.combinatorics.permutations.Permutation.parity() Return : next permutation in lexicographical parity Code #1 : parity() Example Python3 1=1 # Python code explaining # SymPy.Permutation.parity() # importing SymPy libraries from sympy.combinatorics.partitions import Partition from sympy.combinatorics.permutations import Permutation # Using from sympy.combinatorics.permutations.Permutation.parity() method # creating Permutation a = Permutation([[2, 0], [3, 1]]) b = Permutation([1, 3, 5, 4, 2, 0]) print ("Permutation a - parity form : ", a.parity()) print ("Permutation b - parity form : ", b.parity()) Output : Permutation a - parity form : 0 Permutation b - parity form : 1 Code #2 : parity() Example - 2D Permutation Python3 1=1 # Python code explaining # SymPy.Permutation.parity() # importing SymPy libraries from sympy.combinatorics.partitions import Partition from sympy.combinatorics.permutations import Permutation # Using from sympy.combinatorics.permutations.Permutation.parity() method # creating Permutation a = Permutation([[2, 4, 0], [3, 1, 2], [1, 5, 6]]) print ("Permutation a - parity form : ", a.parity()) Output : Permutation a - parity form : 0 Comment More infoAdvertise with us Next Article SymPy | Permutation.parity() in Python N noobestars101 Follow Improve Article Tags : Python SymPy Practice Tags : python Similar Reads SymPy | Permutation.list() in Python Permutation.list() : list() is a sympy Python library function that returns the permutation as an explicit list, possibly trimming unmoved elements if size is less than the maximum element in the permutation. Syntax : sympy.combinatorics.permutations.Permutation.list() Return : permutation as an exp 2 min read SymPy | Permutation.min() in Python Permutation.min() : min() is a sympy Python library function that returns the minimum value in the permutation. Syntax : sympy.combinatorics.permutations.Permutation.min() Return : minimum value in the permutation Code #1 : min() Example Python3 1=1 # Python code explaining # SymPy.Permutation.min() 1 min read SymPy | Permutation.max() in Python Permutation.max() : max() is a sympy Python library function that returns the maximum value in the permutation. Syntax : sympy.combinatorics.permutations.Permutation.max() Return : maximum value in the permutation. Code #1 : max() Example Python3 1=1 # Python code explaining # SymPy.Permutation.max( 1 min read SymPy | Permutation.order() in Python Permutation.order() : order() is a sympy Python library function that calculates the order of a permutation. When the permutation is raised to the power of its order, then, in that case, the order equals the identity permutation. Syntax : sympy.combinatorics.permutations.Permutation.order() Return : 1 min read SymPy | Permutation.is_odd() in Python Permutation.is_odd() : is_odd() is a sympy Python library function that checks whether the permutation is odd. Syntax : sympy.combinatorics.permutations.Permutation.is_odd() Return : true - if the permutation is odd; otherwise false Code #1 : is_odd() Example Python3 1=1 # Python code explaining # S 1 min read Like