PythiloEasy · 12 min · Task 24 of 100 · progress kept in this browser

Move zeros to the end

Return a new list with all numeric zeros last, preserving the order of all other numbers.

items = [0, 1, 0, 3]
nonzero = [x for x in items if x != 0]
print(nonzero, len(items)-len(nonzero))
Your task

Return a new list with all numeric zeros last, preserving the order of all other numbers.