L = [ 0 , 2, 1 , -1 , -1 , -1, -1 ]
for i in L:
if i <= 0:
L.pop ( i )
print L
What I was expecting was that L = [ 0, 2, 1 ]
but the result was [ 2 , 1 , -1, -1 ]
I would like to know why it is such.
( I would also like to directly post python code over here, but I don't know how? )