4 The sum of scores



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



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


return total


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


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