human
Double the first element and move zero to end | function which pushes all zeros to end of an array ..
Count of non - zero elements.
Traverse the array . If element encountered is non - zero , then replace the element at index ' count ' with this element.
here count is incremented.
Now all non - zero elements have been shifted to front and ' count ' is set as index of first 0. Make all elements 0 from count to end ..
function to rearrange the array elements after modification.
if ' arr [ ] ' contains a single element only.
traverse the array.
if true , perform the required modification.
double current index value.
put 0 in the next index.
increment by 1 so as to move two indexes ahead during loop iteration.
push all the zeros at the end of 'arr[]  .
function to print the array elements.
Driver program to test above"
Solution in Python:

=====
Give me a code to double the first element and move zero to end and the other steps required?
assistant
#Here is code to double the first element and move zero to end and the other steps required.
 def pushZerosToEnd ( arr , n ) :
	count = 0
	for i in range ( 0 , n ) :
		if arr [ i ] != 0 :
			arr [ count ] = arr [ i ]
			count += 1
	while ( count < n ) :
		arr [ count ] = 0
		count += 1
def modifyAndRearrangeArr ( ar , n ) :
	if n == 1 :
		return
	for i in range ( 0 , n - 1 ) :
		if ( arr [ i ] != 0 ) and ( arr [ i ] == arr [ i + 1 ] ) :
			arr [ i ] = 2 * arr [ i ]
			arr [ i + 1 ] = 0
			i += 1
	pushZerosToEnd ( arr , n )
def printArray ( arr , n ) :
	for i in range ( 0 , n ) :
		print ( arr [ i ] , end = " ▁ " )
arr = [ 0 , 2 , 2 , 2 , 0 , 6 , 6 , 0 , 0 , 8 ]
n = len ( arr )
print ( " Original ▁ array : " , end = " ▁ " )
printArray ( arr , n )
modifyAndRearrangeArr ( arr , n )
print ( " Modified array : " , end = "   " )
printArray ( arr , n )