4. The sum of scores


#1



https://www.codecademy.com/en/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 319 for grades_sum([95, 97, 39, 86, 2])
<- it displays this on the side, but there is an error message.


I expected the sum (as shown above) and no error message? ^^" Please let me know where I made a mistake!


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

def grades_sum(scores):
    total = 0
    
    for number in grades:
        total += number
    return total
    
print grades_sum(grades)


#2

Hint
In the making of your function you add the parameter "scores" yet you never use it in the function.


#3

Changed "for number in grades" to "for number in scores" and it worked! A silly mistake really :)) Thanks for pointing it out!


#4