Write a Python function to push all zeros to the end of a list.


Topic: Write a Python function to push all zeros to the end of a list.

Solution

def move_zero(num_list):
    a = [0 for i in range(num_list.count(0))]
    x = [ i for i in num_list if i != 0]
    x.extend(a)
    return(x)



List all Python Programs