I wrote a function to remove all zeroes from a list of elements with different datatypes. But while removing the zeroes. The boolean value 'False' is also removed. But when I change it to 'True' it is not removed. I tried many different methods for doing this, but the result is the same.
def move_zeros(array):
for i in range(array.count(0)):
array.remove(0)
print(array)
move_zeros([0,1,None,2,False,1,0])
The output is
[1, None, 2, 1]
How can I do this without getting the 'False' value removed ?