In the belove program
list = [1, 2, 3, 4, 5, 6, 7]
for i in list:
list.pop()
print(list)
print(list)
I am getting output as
[1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5]
[1, 2, 3, 4]
[1, 2, 3]
and why not
[1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5]
[1, 2, 3, 4]
[1, 2, 3]
[1, 2]
[1]