5. Computing the average

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

This average number turns out to be wrong. Can you help me to figure out what’s wrong with it?
<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/python-intermediate-en-7mgOa/1/2?curriculum_id=4f89dab3d788890003000096#
<In what way does your code behave incorrectly? Include ALL error messages.>
Oops, try again. grades_average([8, 2, 0, 9, 0, 5, 7, 2]) returned 80.42307692307692 instead of the expected: 4.125
<What do you expect to happen instead?>

```python

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

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

print grades_sum(grades)

def grades_average(scores):
sums = grades_sum(grades)
x = sums / float(len(grades))
return x

print grades_average(grades)

<do not remove the three backticks above>
1 Like

Your function ignores the data that is given to it when it is called

In what way exactly?

There are a couple ways that your could change your code so that it will work:
A. Change the argument in your grades_average function from scores to grades.

B. Make sure that the argument that is passed in (in this case grades_average(scores)) is used in the rest of your function. sums = grades_sum(grades) and x = sums / float(len(grades)) cannot use the argument scores.

1 Like

Thank you.This helped me.