human
Rearrange positive and negative numbers with constant extra space | A utility function to print an array of size n.
Function to Rearrange positive and negative numbers in a array.
if current element is positive do nothing.
if current element is negative , shift positive elements of arr [ 0. . i - 1 ] , to one position to their right.
Put negative element at its right position.
Driver Code"
How can the above be solved in Python?

Write me a code to rearrange positive and negative numbers with constant extra space and the other steps required?
assistant
#Here is code to rearrange positive and negative numbers with constant extra space and the other steps required.
 def printArray ( arr , n ) :
	for i in range ( n ) :
		print ( arr [ i ] , end = " ▁ " )
	print ( )
def RearrangePosNeg ( arr , n ) :
	for i in range ( 1 , n ) :
		key = arr [ i ]
		if ( key > 0 ) :
			continue
		j = i - 1
		while ( j >= 0 and arr [ j ] > 0 ) :
			arr [ j + 1 ] = arr [ j ]
			j = j - 1
		arr [ j + 1 ] = key
if __name__ == " _ _ main _ _ " :
	arr = [ - 12 , 11 , - 13 , - 5 , 6 , - 7 , 5 , - 3 , - 6 ]
	n = len ( arr )
	RearrangePosNeg ( arr , n )
	printArray ( arr , n )