human
Give me a code to find minimum difference between any two elements and the other steps required given the following:
Find minimum difference between any two elements | Returns minimum difference between any pair.
Sort array in non - decreasing order.
Initialize difference as infinite.
Find the min diff by comparing adjacent pairs in sorted array.
Return min diff.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find minimum difference between any two elements and the other steps required.
 def findMinDiff ( arr , n ) :
	arr = sorted ( arr )
	diff = 10 ** 20
	for i in range ( n - 1 ) :
		if arr [ i + 1 ] - arr [ i ] < diff :
			diff = arr [ i + 1 ] - arr [ i ]
	return diff
arr = [ 1 , 5 , 3 , 19 , 18 , 25 ]
n = len ( arr )
print ( " Minimum ▁ difference ▁ is ▁ " + str ( findMinDiff ( arr , n ) ) )