I'm trying to delete binary numbers from a list that don't contain the number of zeroes a user enters.
a = []
for i in range(512):
a.append(format(i, '09b'))
b = int(input("Enter zeroes: "))
for i in a:
if i.count('0') != b:
del(i)
for i in a:
print(i)
But running this code still yields the full list of 9 bit numbers. Where am I going wrong?