Part of a Whole (Wrong Average)


#1



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


get_class_average([alice, lloyd]) returned 91.15 instead of 85.85 as expected


I was expecting the average to be 85.85. (What am I doing wrong?)


def get_class_average(students):
    results= []
    for x in students:
        results.append(get_average(x))
        print average(results)
        return average(results)


#2

As suspected, this line is over-indented.


#3

Thanks! I get it now!


#4

What does over indented means here?


#5

def get_class_average(students):
    results= []
    for x in students:
        results.append(get_average(x))
        print average(results)
        return average(results)

The return statement has too much indentation. It should line up with the for, and no be inside the loop block.


#6

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