human
Rearrange array such that difference of adjacent elements is in descending order | Function to print array in given order.
Sort the array.
Check elements till the middle index.
Check if length is odd print the middle index at last.
Print the remaining elements in the described order.
Driver code.
Array declaration.
Size of array"
How can the above be solved in Python?

Write me a code to rearrange array such that difference of adjacent elements is in descending order and the other steps required?
assistant
#Here is code to rearrange array such that difference of adjacent elements is in descending order and the other steps required.
 def printArray ( a , n ) :
	a . sort ( ) ;
	i = 0 ;
	j = n - 1 ;
	while ( i <= j ) :
		if ( i == j ) :
			print ( a [ i ] , end = " ▁ " ) ;
		else :
			print ( a [ j ] , end = " ▁ " ) ;
			print ( a [ i ] , end = " ▁ " ) ;
		i = i + 1 ;
		j = j - 1 ;
	print ( ) ;
if __name__ == " _ _ main _ _ " :
	arr1 = [ 1 , 2 , 3 , 4 , 5 , 6 ] ;
	n1 = len ( arr1 ) ;
	printArray ( arr1 , n1 ) ;