Part of the whole


The code returns an error message: Oops, try again. get_class_average([alice]) returned 80.55 instead of 91.15 as expected

what is wrong withe code? I don't get what's the problem

_class = [lloyd, alice, tyler]

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


the for loop is used to iterate through something. Since there is nothing in the program named _class, what should be there?


He includes it, so this isn't the issue.


Your return statement should be outside the for loop.


Ahh, didn't notice that. Good call.


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