human
Positive elements at even and negative at odd positions ( Relative order not maintained ) | Print array function.
Driver code.
before modification.
out of order positive element.
find out of order negative element in remaining array.
out of order negative element.
find out of order positive element in remaining array.
after modification"
Solution in Python:
 Give me a code to positive elements at even and negative at odd positions ( Relative order not maintained ) and the other steps required?
assistant
#Here is code to positive elements at even and negative at odd positions ( Relative order not maintained ) and the other steps required.
 def printArray ( a , n ) :
	for i in a :
		print ( i , end = " ▁ " )
	print ( )
arr = [ 1 , - 3 , 5 , 6 , - 3 , 6 , 7 , - 4 , 9 , 10 ]
n = len ( arr )
printArray ( arr , n )
for i in range ( n ) :
	if ( arr [ i ] >= 0 and i % 2 == 1 ) :
		for j in range ( i + 1 , n ) :
			if ( arr [ j ] < 0 and j % 2 == 0 ) :
				arr [ i ] , arr [ j ] = arr [ j ] , arr [ i ]
				break
	elif ( arr [ i ] < 0 and i % 2 == 0 ) :
		for j in range ( i + 1 , n ) :
			if ( arr [ j ] >= 0 and j % 2 == 1 ) :
				arr [ i ] , arr [ j ] = arr [ j ] , arr [ i ]
				break
printArray ( arr , n ) ;