So I have some code:
nlist = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,2,0]
count = 0
for i in nlist:
if nlist[i] == 0:
nlist.remove(nlist[i])
count += 1
if count == 4:
count = 0
print(nlist)
And when ever i run it the Output is:
[0, 0, 0, 0, 0, 0, 2, 0]
Even though the output should be this:
[2]
Can someone please tell me what I am doing wrong.