I'm using remove() to delete element from list but the loop is skipping few elements. Below is the code:
m=[14,24,24,7,82,85,82,4,60,95]
for i in m:
print(i)
m.remove(i)
The outcome of the above code is: 14 24 82 82 60. Which means that only the printed elements are removed.
After the code execution, m is [24, 7, 85, 4, 95], whereas it should be null. Can somebody explain this?