replaced if with while in print(students) method