What's wrong?



<Below this line, add a link to the EXACT exercise that you are stuck at.>
the exercise was:
Takes in a list of scores, scores
Computes the sum of the scores
Returns the computed sum
Call the newly created grades_sum() function with the list of grades and print the result.
<In what way does your code behave incorrectly? Include ALL error messages.>
Oops, try again. It looks like your grades_sum function doesn’t properly compute the sum of all the grades! It returned None instead of 188 for grades_sum([36, 1, 95, 56])
<What do you expect to happen instead?>
to print out the sum, which it did but when it tested my code (as in the error message) it returned none.


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

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

<do not remove the three backticks above>


i think all you have to do is to replace print total by return total , so the function return variable not to print on screen .
The print statement will only print something on the screen so the user can see while a return statement will make the program return to where the function was called, bring back a value (if there’s any if not, None) and continue with the execution of the code.


You should return not print total


I found this very confusing the way they are asking, they want you to return the value within the function and print the results of the function at the end… wasted way too much time on this because of poorly phrased instructions


what is confusing about that, your function needs to return something and they are asking you to print what your function returned