How to access items in the list?

I had a misunderstanding with lists...

There is a list:

testlist = ['1111',

I made a loop iterate through the elements and their subsequent removal:

while testlist:
 for items in testlist:
 print ('Take item',items)
 print ('Removed',testlist.pop(0))

Why is the output element print(items) removes them completely randomly, and when the idea should work in the same manner as .pop(0) ?
uses the print I have, for clarity, in fact, there is a function that I want to transfer these elements is out of print.

Console output:

Take element 1111
Remove 1111
Take element 3333
Remove 2222
Take element 5555
Remove 3333
Take the item 4444
Remove 4444
Take element 5555
Remove 5555

I'm still very green on this probably just don't know something simple :(
July 9th 19 at 10:41
2 answers
July 9th 19 at 10:43
Cycle for here.

 x = testlist.pop(0)
 print('Take an element', x)
 print('Remove', x)
While parentheses have, too. It's a Python. - Ramon.Stracke commented on July 9th 19 at 10:46
July 9th 19 at 10:45
Because you cannot change the list (and any other collection), during an iteration on it though.
That is, the method "to refer to an item-remove it-to turn to the next item" (and so on until the empty list) does not exist? - Ramon.Stracke commented on July 9th 19 at 10:48
There is: just delete the items until the list is empty.
Why are there you have two nested loops, by the way?
Just one:
Get the element and do what you want with it.

But why do you want to remove the items, the more to the left? - bailey.Okuneva commented on July 9th 19 at 10:51

Find more questions by tags Python