4 The sum of scores


#1


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


Why am I getting " It looks like your grades_sum function doesn't properly compute the
sum of all the grades! It returned None instead of 175 for
grades_sum([78, 35, 62])" when the function is actually bringing the correct answer?


def grades_sum(scores):
    total = 0
    
    for i in scores:
        total += i
    print total

grades_sum(grades)


#3

@bibleman13,
That post doesn't apply to @whatismae88's problem at all.

The issue is your function returned None, because you printed.

Simply change the line:

print total

to:

return total

#4

Ok then. Thought it would help since the guy had the same error. Thanks for the correction!


#5

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