# Exam Statistics 5/9 Typo?

#1

This is a typo on Codecademys part right?

They tell us:

Define a function, grades_average, below the grades_sum function that does the following:

_ Has one argument, grades_input, a list_
_ Computes the average of the grades by dividing that sum by float(len(grades_input))._
_ Returns the average._

Call the newly created grades_average function with the list of grades and print the result.

Because I tried calling the function with grades_input and it didnt work!
Then called the function with grades and everything worked!

My code:

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

total = 0
for score in scores:
total += score

return average

``````

#2

Correct.

Aside

One could be at odds with the suggested code, though. The greater likelihood is that the numerator may be a float, not the denominator in this case. It is a counting number, not a float. Why cast this value when the numerator makes natural sense? Just saying…

Eg.

``float(x) / len(n)``

#3

I just followed the instructions…they told us:

…so thats why I did it this way, but I see what you mean

#4

which is what I’m at odds with, not your code. The author should never have written the example that way, imho.

#5

Oh I see I see. I think Codecademy should go through all of their courses, and fix instructions, explanations and solutions…Im only doing the Python course and I’ve already lost count of how many things that are unnecessary or confusing in that course that could be easily fixed and make the learning process more enjoyable and less frustrating

#6

We have what we have, warts and all. The tracks can be completed and there is always the forum where we can find explanations and workarounds.

#7

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