Error in Exam Statistics


#1



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


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

What is wrong with my code? Help me please.


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

def grades_sum(scores):
    result = sum(int(i) for i in scores)
    return result
print grades_sum(grades)


#2

Hi @luiz42,

In this line ...

    result = sum(int(i) for i in scores)

... int(i) converts each grade to an int, including the 50.5. As a result of the conversion, that grade becomes 50 prior to being added to the total. Consequently, the total is incorrect.


#3

Thank you @appylpye, I realized what my error was and fixed it.


#4