The sum of scores


#1



https://www.codecademy.com/courses/python-intermediate-en-7mgOa/1/1?curriculum_id=4f89dab3d788890003000096

Oops, try again. It looks like your grades_sum function doesn't properly compute the sum of all the grades! It returned 1045.5 instead of 236 for grades_sum([76, 13, 22, 41, 84])

Could someone please explain why I am getting the above error? The code appears to be correct when computing the grades given in the editor but the error uses a different list for the grade and is telling me that my function returned 1045.5. I have no idea how to fix this.


grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(scores):
    total = 0.0
    for g in grades:
        total += g
    return total
print grades_sum(grades)


#2

Your for loop needs to reference the argument in grades_sum, meaning scores. So you want to use g in scores. Does that make since?


#3