human
Segregate even and odd numbers | Set 3 | Function to segregate even odd numbers.
Swapping even and odd numbers.
Printing segregated array.
Driver Code"
How can the above be solved in Python?
 What is a code to segregate even and odd numbers and the other steps required?
assistant
#Here is code to segregate even and odd numbers and the other steps required.
 def arrayEvenAndOdd ( arr , n ) :
	i = - 1
	j = 0
	while ( j != n ) :
		if ( arr [ j ] % 2 == 0 ) :
			i = i + 1
			arr [ i ] , arr [ j ] = arr [ j ] , arr [ i ]
		j = j + 1
	for i in arr :
		print ( str ( i ) + " ▁ " , end = ' ' )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 3 , 2 , 4 , 7 , 6 , 9 , 10 ]
	n = len ( arr )
	arrayEvenAndOdd ( arr , n )