How come one-line foreach removes alternative elements in list and not removes everything? or how is the implementation of the foreach loop?
aList = ['xyz', 1, 'zara', 2, 'xyz']
for i, ele in enumerate(aList):
    print(i, ele)
    aList.remove(ele)
print(aList)
0 xyz
1 zara
2 xyz
[1, 2]
 
     
    