human
Move all zeroes to end of array | Set | function to move all zeroes at the end of array.
Count of non - zero elements.
Traverse the array . If arr [ i ] is non - zero , then swap the element at index ' count ' with the element at index 'i  .
function to print the array elements.
Driver program to test above"
How can the above be solved in Python?
assistant
#Here is code to move all zeroes to end of array and the other steps required.
 def moveZerosToEnd ( arr , n ) :
	count = 0 ;
	for i in range ( 0 , n ) :
		if ( arr [ i ] != 0 ) :
			arr [ count ] , arr [ i ] = arr [ i ] , arr [ count ]
			count += 1
def printArray ( arr , n ) :
	for i in range ( 0 , n ) :
		print ( arr [ i ] , end = " ▁ " )
arr = [ 0 , 1 , 9 , 8 , 4 , 0 , 0 , 2 , 7 , 0 , 6 , 0 , 9 ]
n = len ( arr )
print ( " Original ▁ array : " , end = " ▁ " )
printArray ( arr , n )
moveZerosToEnd ( arr , n )
print ( " Modified array : " , ▁ end = "   " )
printArray ( arr , n )