Exercise 5: replaced each() method with a while loop to print all cohort