<filename>lists_04/push_all_zeros_to_the_end_of_the_list.py
# Given a list of random numbers, push all zeros to the end of the list
# For example, if the given list is [2, 6, 1, 4, 0, 0, 3, 8, 0, 6, 0],
# it should be changed to [2, 6, 1, 4, 3, 8, 6, 0, 0, 0, 0]
# The order of all other elements should be same
# for more info on this quiz, go to this url: http://www.programmr.com/push-all-zeros-end-list


def zeroes_to_end(arr_x):
    new_lst = []
    for i in arr_x:
        if i > 0:
            new_lst.append(i)

    for i in range(len(arr_x)):
        if arr_x[i] == 0:
            new_lst.append(arr_x[i])
    return new_lst


print(zeroes_to_end([2, 6, 1, 4, 0, 0, 3, 8, 0, 6, 0]))

<filename>lists_04/push_all_zeros_to_the_end_of_the_list.py
# Given a list of random numbers, push all zeros to the end of the list
# For example, if the given list is [2, 6, 1, 4, 0, 0, 3, 8, 0, 6, 0],
# it should be changed to [2, 6, 1, 4, 3, 8, 6, 0, 0, 0, 0]
# The order of all other elements should be same
# for more info on this quiz, go to this url: http://www.programmr.com/push-all-zeros-end-list


def zeroes_to_end(arr_x):
    new_lst = []
    for i in arr_x:
        if i > 0:
            new_lst.append(i)

    for i in range(len(arr_x)):
        if arr_x[i] == 0:
            new_lst.append(arr_x[i])
    return new_lst


print(zeroes_to_end([2, 6, 1, 4, 0, 0, 3, 8, 0, 6, 0]))

# Given a list of random numbers, push all zeros to the end of the list # For example, if the given list is [2, 6, 1, 4, 0, 0, 3, 8, 0, 6, 0], # it should be changed to [2, 6, 1, 4, 3, 8, 6, 0, 0, 0, 0] # The order of all other elements should be same # for more info on this quiz, go to this url: http://www.programmr.com/push-all-zeros-end-list