
# Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.

# move_zeros([1, 0, 1, 2, 0, 1, 3]) 
# returns [1, 1, 2, 1, 3, 0, 0]

def move_zeros(array):
    zeros = 0
    size = len(array)
    for i in range(size):
        if array[i] == 0:
            zeros += 1
    novalista = list(filter(lambda a: a != 0, array))
    
    for i in range(zeros):
        novalista.append(0)
        
    return novalista
