A bug in exercise 16. Exam statistics 2.1


#1

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

I have written a completely correct code. However, I get messages like this

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 351 for grades_sum([3, 61, 37, 80, 84, 86])

even though the code actually returns the noted value.


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

def grades_sum(scores):
    total=0
    for i in range(0,len(scores)):
        total+=scores[i]
    print total
grades_sum([14, 62, 29, 85])
grades_sum([54, 45, 38, 74, 62, 64])

Looking forward to some help


#2

Message says you're not returning anything. You seem to be printing instead of returning.


#3

Omg I missed some part of the task. I'm so careless. Thanks bro


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.