(very late reply)
Modifying the list will interfere with the loop. You move elements when you remove at the front, while at the same time the loop progresses forwards.
Also, all that moving makes it very inefficent. If you reversed it first, then you could pop until the last value is no longer even. Popping is fast and the loop wouldn’t be affected (however you should not use a for-loop because that doesn’t match what you’re doing, which is repeating something until a condition’s outcome changes)