Student is not defined


I’m not quite sure what is going on here. But I think that my code to part of the whole is the same as the solution code, yet when i run it i get an error saying that the global name ‘student’ is not defined. this is what i wrote:
def get_class_average(class_list):
results = []
for pupil in class_list:
stud_avg = get_average(student)
return average(results)
again, as near as i can tell this is exactly what the solution code is. whats wrong here?

Why is the average returned incorrect?

Change pupil to student.


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