Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
list methods solution in Clear category for Move Zeros by Red_Ale
def move_zeros(items: list[int]) -> list[int]:
for i in range(items.count(0)):
items.remove(0)
items.append(0)
return items
print("Example:")
print(move_zeros([0, 1, 0, 3, 12]))
assert move_zeros([0, 1, 0, 3, 12]) == [1, 3, 12, 0, 0]
assert move_zeros([0]) == [0]
print("The mission is done! Click 'Check Solution' to earn rewards!")
Nov. 3, 2022
Comments: