human
Sort all even numbers in ascending order and then sort all odd numbers in descending order | To do two way sort . First sort even numbers in ascending order , then odd numbers in descending order ..
Make all odd numbers negative.
Check for odd.
Sort all numbers.
Retaining original array.
Driver code"
Solution in Python:
 Give me a code to sort all even numbers in ascending order and then sort all odd numbers in descending order and the other steps required?
assistant
#Here is code to sort all even numbers in ascending order and then sort all odd numbers in descending order and the other steps required.
 def twoWaySort ( arr , n ) :
	for i in range ( 0 , n ) :
		if ( arr [ i ] & 1 ) :
			arr [ i ] *= - 1
	arr . sort ( )
	for i in range ( 0 , n ) :
		if ( arr [ i ] & 1 ) :
			arr [ i ] *= - 1
arr = [ 1 , 3 , 2 , 7 , 5 , 4 ]
n = len ( arr )
twoWaySort ( arr , n ) ;
for i in range ( 0 , n ) :
	print ( arr [ i ] , end = " ▁ " )