Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
61 chars solution in Creative category for Duplicate Zeros by Sim0000
#000000001111111111222222222233333333334444444444555555555566
#234567890123456789012345678901234567890123456789012345678901
duplicate_zeros=f=lambda d:d and[d[0]]+[0]*(d[0]==0)+f(d[1:])
print("Example:")
print(duplicate_zeros([1, 0, 2, 3, 0, 4, 5, 0]))
assert duplicate_zeros([1, 0, 2, 3, 0, 4, 5, 0]) == [1, 0, 0, 2, 3, 0, 0, 4, 5, 0, 0]
assert duplicate_zeros([0, 0, 0, 0]) == [0, 0, 0, 0, 0, 0, 0, 0]
assert duplicate_zeros([100, 10, 0, 101, 1000]) == [100, 10, 0, 0, 101, 1000]
print("The mission is done! Click 'Check Solution' to earn rewards!")
Sept. 14, 2022