This was an example code of potential errors that could occur while working with mutable lists (from an exercise).
my_list = [1,2,5,4]
for i in my_list:
print(i)
my_list.remove(i)
print(my_list)
It prints
1
5
[2, 4]
But why does it react like it does?