Почему эта программа на Python не дает желаемого результата?
This question already has answers here:
Modifying list while iterating [duplicate] (7 answers)
Strange result when removing item from a list while iterating over it (3 answers)
Your post has been associated with similar questions. If these questions don’t resolve your question, ask a new one.
Closed 11 hours ago.
(Private feedback for you)
I have started learning Python. So I tried to run the following program:
nom = [1, 2, 3, 4, 5, 6]
for x in nom:
print(nom)
nom.pop(1)
print(nom)
I expected to get 1 printed at the end , but what I got is:
[1, 2, 3, 4, 5, 6]
[1, 3, 4, 5, 6]
[1, 4, 5, 6]
[1, 5, 6]
As the loop seems interrupted in midway. Why is that? please explain
What I have tried:
<pre>As the loop seems interrupted in midway. Why is that? please explain