The first one is:
a = [1, 2, 3, 4]
for i in a:
print(i)
a.pop()
Output:
1
2
My interpretation is that when the index i comes to the second element (2), the list only keeps [1, 2]. And then for the third run of loop, there's no element left to traverse.
However, when I keep the concept which I describe above and then tried the following code, the outcome doesn't make sense to me at all.
d = [1,2,3,4]
for i in d:
*d, f = d
print(i)
Output:
1
2
3
4
Hope someone can help me figure out the correct concept and go through the details.