3.6. Using a while Loop with Lists and Dictionaries
A for loop is effective for looping through a list, but you shouldn't modify a list inside a for loop because Python will have trouble keeping track of the items in the list. To modify a list as you work through it, use a while loop. We'll look at some examples.