Maybe because you're only modifying things you've already iterated over. Regardless, you probably shouldn't do it, and you definitely shouldn't rely on it working right all the time.
In this case, you don't need to (since you only iterate over the list once, and do the same thing with every value in the list regardless of what that value is), and for the same reason, you also don't need a while loop, since it'll only ever run once anyway.
In this case, you don't need to (since you only iterate over the list once, and do the same thing with every value in the list regardless of what that value is), and for the same reason, you also don't need a while loop, since it'll only ever run once anyway.