0
Why this output?
Instead of popping 1 it is popping 4? https://code.sololearn.com/cmDt0oDeL7s4/?ref=app
3 Respuestas
+ 6
When you pop the first element in your list, all the elements shift up one place, so the element in second place of original list is now in first place. Your loop pops the first element, then the second element (of the new list), then the third element (of the even newer list). Consequently, Your first element is removed first of all, then your third element, and lastly your fifth.
To see this is action, simply put your print statement inside your for loop, and see how it looks after each step.
+ 3
Link your codebits first.
+ 2
Show your code here