I have this list [1268857, 384269, 72468, 161, 0, 0, 0, 0, 0, 0, 0]
, in which I compute a log calculation on each value. So I first remove the zeros and then I get this list: [14.05362705319161, 12.859098107153008, 11.190900364095901, 5.0814043649844631]
. But the problem is that the last list will repeat itself 7 times. Is there a way to stop it from generating itself over and over?
I've tried this:
for item in gy:
if item == 0:
gy.remove(item)
if item < 0:
gy.remove(item)
if item == (item - 1):
gy.remove(item)
Although it removes the next item that repeats himself, gives me also an error:
ValueError: list.remove(x): x not in list
Is there a better way to do this?