False == 0 problem
So there is a challenge in a website which is taking away my mental health The chalange is to move zeros of a list to the end without messing other items indices. My code: def move_zeros(array): for i in array: if str(i).isnumeric(): if i == 0: array.remove(i) array.append(i) return array The problem is the condition in my function doesn't filter the False if its present in the list. For example in this list : ["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9] It keeps removing False and adding 0 to the end I wrote another condition: for i in array: if type(i) == int and i == 0: array.remove(i) array.append(i) return array And even I tried (if str(i) == "0") But it just doesn't work and honestly I don't know why and what I'm missing here. Please help me understand.