0
a=[1,2,3,4,5] for i in a: a.remove(i) print(a)
How it actual executes
1 Resposta
+ 4
Palagani akhila gowd
As the for loop executes 0 is elimated the 1 in the array and the array a becomes [2,3,4,5]
The for loop i is now 1 so 3 will be elimated and the array a becomes [2,4,5]
The for loop i is now 2 so 5 will be elimated and the array a becomes [2,4]