# 7. Variance

#1

Hi, Im not passing even tough I get the results
Im supposed to get ( I tested the input which the console returns me
with a error message). I dont find a mistake.... Any suggestions?

Oops, try again.
grades_variance([8, 5, 6, 8, 0, 5, 6, 3, 7]) returned 5644.2473701512 instead of the expected: 5.7777777778

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

total = 0

return durchschnitt

variance = 0
for score in scores:
variance += (average - score) ** 2
total_variance = variance/float(len(scores))

#2

Hint: Should you get the average of the globally defined `grades`, or the grades that have been passed to you as an argument `scores`?

``average = grades_average(grades) # reconsider this line``

#3

ouuu okay... thanks!!!

#4

A post was split to a new topic: Variance

#5

i didnt get youwhat you have said..!?

#6

If you call `grades_average` like this:

``````grades_average(my_scores)

where each different list passed to it gives a different output, it makes sense for `grades_average` to compute the average of the grades list passed to it as an argument.

#7

this is what i was missing..

total_variance = variance/float(len(scores))

thank you

#8

I have a problem:

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

total = 0

return average

variance = 0
for score in scores:
variance += (average - score) ** 2
a =  variance / scores
return a

My error is:

``````Traceback (most recent call last):
File "python", line 25, in <module>
File "python", line 23, in grades_variance
TypeError: unsupported operand type(s) for /: 'float' and 'list'``````

#9

In this line, you are dividing a float by a list. That isn't really what you're asked to do

#10

Do you know that i am already at the next lesson? Mute!!

#11