Part of the Whole


#1

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


https://www.codecademy.com/en/courses/python-beginner-en-qzsCL/1/4?curriculum_id=4f89dab3d788890003000096


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:
        results.append(get_average(student))
        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.


#2

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?


#3

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


#4