human
Maximum difference between groups of size two | Python 3 program to find minimum difference between groups of highest and lowest.
Sorting the whole array ..
Driver code"
How can the above be solved in Python?
 ... Write me a code to maximum difference between groups of size two and the other steps required?
assistant
#Here is code to maximum difference between groups of size two and the other steps required.
 def CalculateMax ( arr , n ) :
	arr . sort ( )
	min_sum = arr [ 0 ] + arr [ 1 ]
	max_sum = arr [ n - 1 ] + arr [ n - 2 ]
	return abs ( max_sum - min_sum )
arr = [ 6 , 7 , 1 , 11 ]
n = len ( arr )
print ( CalculateMax ( arr , n ) )