Part of the Whole


Currently I'm stuck on Part of a Whole from Student Becomes the Teacher..

Oops, try again. get_class_average([alice, lloyd]) returned 91.15 instead of 85.85 as expected

Based on this error message, it seems the list of students may be where the issue lies, but this list is provided by the system when it calls the get_class_average function. You'll notice that the error message only lists Alice and Lloyd, it's missing Tyler; and I'm sure Tyler definitely would drop the average down a bit..

def get_class_average(students):
    results = []
    for student in students:
        return average(results)

I checked over the instructions and my code several times, I also did some searching in the topics here but couldn't find the solution to my issue.


Hi @makeitlife,

Due to the degree to which it is indented, this statement is included within your for loop ...

        return average(results)

Is that what you intended?


Thanks for setting me straight! Moving the indentation on the return did the trick..