human
Write me a code to segregate even and odd numbers and the other steps required given the following:
Segregate even and odd numbers | Set 3 | Python3 implementation of the above approach.
Driver code.
Function call"
Solution in Python:
assistant
#Here is code to segregate even and odd numbers and the other steps required.
 def arrayEvenAndOdd ( arr , n ) :
	ind = 0 ;
	a = [ 0 for i in range ( n ) ]
	for i in range ( n ) :
		if ( arr [ i ] % 2 == 0 ) :
			a [ ind ] = arr [ i ]
			ind += 1
	for i in range ( n ) :
		if ( arr [ i ] % 2 != 0 ) :
			a [ ind ] = arr [ i ]
			ind += 1
	for i in range ( n ) :
		print ( a [ i ] , end = " ▁ " )
	print ( )
arr = [ 1 , 3 , 2 , 4 , 7 , 6 , 9 , 10 ]
n = len ( arr )
arrayEvenAndOdd ( arr , n )