'python, removing items from list [duplicate]

I'm very confused. When I run the following code I assume the list, l, ends empty but always ends with one remaining item, i.e.:

l = [1,2,3]
for item in l: 
    l.remove(item)
    
print(l) 

the result is [2]

but if I re-run the same loop again the list is finally emptied

for item in l: 
    l.remove(item)
    
print(l)

the result is []

Sure there is something I'm doing wrong but for now what I'm getting is very annoying.

I apreciate if somebody can explains me what's going on.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source