Shrinking Underfoot
This helper is supposed to strip every zero out of a list in place.
def strip_zeros(a):
for i, x in enumerate(a):
if x == 0:
a.remove(0)
return a
What does strip_zeros([0, 0, 1, 0, 0]) return?
Sign in to answer questions and track your progress
Sign In