Faced a task on the codebook and seemed to be solved if it were not for one thing! The task itself is simple to the point of insanity, you need in the list everything that is 0 (zero) sent to the end of the line. it works
def move_zeros(array): for i in array: array.append(array.pop(array.index(0))) if array.index != 0: continue print(array) # [9, -10, {}, True, 1, 2, 'a', 1, 1, [], None, 3, 'z', 1, 0, 0, 0, 0, 0, 0, 0] But until False is slipped into the data.
if array.index != 0 and array.index is False: I still get something like
[9, -10, {}, True, 1, 2, 'a', 1, 1, [], None, 3, 'z', 1, 0, 0, 0, False, 0, 0, 0, 0]