I'm trying to move all zeros in the list to the end of the line, my only problem is that the list has False bool. I just found out that False == 0, since I move all zeros to the end of the list and keep false intact?
def move_zeros(array): #your code here for i in array: if i == 0: array.remove(i) array.append(i) answer = array print answer
move_zeros(["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9])
This is what is returned at startup.
['a', 'b', None, 'c', 'd', 1, 1, 3, [], 1, 9, {}, 9, 0, 0, 0, 0, 0, False, 0, 0, False, 0, 0]