What's wrong?


#1



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.

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])

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):
    total=0
    for i in x:
        total= total + i
    print total
grades_sum(grades)


#2

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.


#3

You should return not print total


#4

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


#5

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