Part of the whole


#1



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


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


#2

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


#3

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


#4

Your return statement should be outside the for loop.


#5

Ahh, didn't notice that. Good call.


#6

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