zeroes = 0 while 0 in nums: nums.remove(0) zeroes = zeroes + 1 for z in xrange(0, zeroes): nums.append(0)
What I want to know is how the
while x in list mechanism works in Python. How can Python just select all elements in a list that are equal to x, and act upon those elements?
Also what does this problem even teach? If I was given this problem, I have no idea what technical knowledge I'm supposed to be demonstrating here.