The reasoning behind why the code on lines 51 and 53


#1

I don’t understand the reasoning behind why the code on lines 51 and 53 is there.


FAQ: Learn Python: Student Becomes the Teacher - How is Everybody Doing?
#2
students = [lloyd, alice, tyler]

This list is more for convenience and organization than anything else. Rather that have to refer to each dictionary separately, we can refer to the list and all the references are there, in one place. We can iterate over this list as many times as we need and never miss or leave out a student.

print get_class_average(students)

The function expects this list of object references, and is able to compute the average for every student in the list.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.