[SOLVED] 4/9; Is this a bug?


grades = [100, 100, 90, 4080, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(scores):
total = 0
for item in scores:
total += int(item)
return total

print grades_sum(grades)

This code returns the error "Oops, try again. Make sure to print the result of the grades_sum() function." However, the result window even shows 1045 and I'm doing everything the problem is asking for. What am I doing wrong?


It's not a bug.

The correct answer is 1045.5.

Why do you cast all numbers to integers before adding them to the sum?


Oh, whoops. I feel dumb. My bad.


No need to feel dumb! Mistakes are an integral part of programming :smile: