change for loop to while loop in exercise 2