5/9 - Exam stats

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

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

print (grades_sum(grades))

def grades_average(grades_input):
    input = len(grades)
    a = float(grades_sum(grades)/input)


whats wrong with this code?I executed this in pycharm and i am getting the desired o/p but the codecademy console says it has some error


i find it impressive you can compile an interpreted language.

if you actually include the error message or the exercise url (preferable) both, you are making things a lot easier for the helping side, getting a better reply in return. This is the error message i get:

grades should contain [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]!

it looks like your list doesn’t contain the right values, a pretty self explaining error?

seems you missed the last bullet point of the instructions:

Returns the average.

you should recognize return as a keyword.

also, your function has a parameter (grades_input) but you are not using it, why?


even with the same values i get the desired output,i have tried multiple i/p


if you don’t bother to read my reply and improve upon what i suggest, its frustrating for me

The reply you just gave me is something i can’t do much with. Maybe i am not the right person to help you


hey i just fixed it got the output.Thanks

And sorry for the incomplete information,next time for any doubt would provide you with adequate information!


here is a good topic:

Quick Tips for Writing Good Posts

which explains the information required and why we require it. In the end, this only helps yourself. Given you get a better response.


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