Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Move Zeros by Serg900vd
def move_zeros(items: list[int]) -> list[int]:
a, b = [],[]
for j in items:
if j :
a.append(j)
else:
b.append(j)
return a + b
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!")
Sept. 10, 2022
Comments: