8/9 Student Becomes Teacher


#1

Why do I get an error when I make class_list = [lloyd, alice, tyler] within the definition of get_class_average(class_list)

Why must class_list be defined outside of the definition of get_class_average(class_list)


#2

The list is supposed to be passed as an argument, not declared inside the function. That effectively nullifies any class_list the function is called on.

Back in lesson 4 we had a list called students. It vaporized in lesson 5. If you add the list to your data section, then call the function on it, (removing that statement in the function body) your class_list may be any list of students, not just Lloyd, et al.

students = [lloyd, alice, tyler]

just below your dictionaries, and later on,

print get_class_average(students)

#3

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