"Oops, try again. Make sure to print the result of the grades_sum() function."


#1

https://www.codecademy.com/courses/python-intermediate-en-7mgOa/1/1?curriculum_id=4f89dab3d788890003000096

If I add print lines, I see the total is as it should be, but I get the error message as below anyway.

Oops, try again. Make sure to print the result of the grades_sum() function.

I’m missing something, but I can’t seem to figure out what.

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

def grades_sum(scores):
    total = 0 # assign before referencing
    for g in scores:
        total = float(g + total)
    total = int(total)
    print total
    return total

#2

from the instructions:

Call the newly created grades_sum() function with the list of grades and print the result.

i don’t see the function call?


#3

Ah! Same error :wink:

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

def grades_sum(scores):
    total = 0 # assign before referencing
    for g in scores:
        total = float(g + total)
    total = int(total)
    print total
    return total
    
print grades_sum(grades)

but when doing that, I noticed that the total = int(total) was wrong. Thank you :wink:

The code below was accepted:

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

def grades_sum(scores):
    total = 0 # assign before referencing
    for g in scores:
        total = float(g + total)
    print total
    return total
    
print grades_sum(grades)

#4