Not Computing?


#1

So I've done this, and checked it like 90 times against other's codes, and an error saying that my program isn't calculating the sum of everything, and it keeps returning "None". Help?

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

def grades_sum(scores):
total = 0
for g in scores: #to get every individual grade
total += g
print total

grades_sum(grades)

"""Error: 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 381 for grades_sum([73, 28, 85, 3, 32, 82, 42, 36])"""


#2

I've had the same issue. I've also contact CodeAcademy and have yet to receive a response.


#3

The function is supposed to return the total, not print it.


#4

with return, the output is 'None'.


#5

here is my solution. The "return total" was missing

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

def grades_sum(scores):
.... total=0
.... for n in scores:
......... total+=n
......... print total
.... return total

grades_sum(grades)`