4/9 Error


#1

So here's the scoop.

Code runs in the console and displays "1045.5" as I suspect it should. However none of the examples CC uses in the background don't work and they all (I suspect) return errors. What am I doing wrong? Looking at other inquiries into the same problem it seems what I've done is acceptable. I don't know what else to do. If the in code example works with the information they gave why would nothing else work?

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

def grades_sum(scores):
    number=0
    for digit in scores:
        number += digit
    print number

grades_sum(grades)

The garbage answer I get from the computer is:

"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 257 for grades_sum([36, 55, 62, 78, 25, 1])"

Thanks for all help fellas!

EDIT: Stare at something long enough and you'll find your problem. I kept trying to force the function to print as opposed to just print the response of the function. Hilarious mistake. Anyways if anybody is curious here's the proper way I figured out:

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

def grades_sum(scores):
    number=0
    for digit in scores:
        number += digit
    return number

print grades_sum(grades)

#2
print "The sum of all grades is: "+ str(grades_sum(grades))