I have a Python list and an element that I am trying to remove, but the element still remains. I would like to understand why this is happening.
for a in lst: if a == 3: lst.remove(a)
And this is the output that I get, notice that 3 is still present in the list. Could you help to understand why this is happening.
[1, 2, 1, 2, 4, 5, 6, 3]
Source: Python Questions