human
Count Inversions in an array | Set 1 ( Using Merge Sort ) | Python3 program to count inversions in an array.
Driver Code"
Solution in Python:
 Give me a code to count Inversions in an array and the other steps required?
assistant
#Here is code to count Inversions in an array and the other steps required.
 def getInvCount ( arr , n ) :
	inv_count = 0
	for i in range ( n ) :
		for j in range ( i + 1 , n ) :
			if ( arr [ i ] > arr [ j ] ) :
				inv_count += 1
	return inv_count
arr = [ 1 , 20 , 6 , 4 , 5 ]
n = len ( arr )
print ( " Number ▁ of ▁ inversions ▁ are " , getInvCount ( arr , n ) )