# The Variance

#1

I have no idea what i did wrong, and why it does not work as it shoud.

error message : Oops, try again. grades_variance([4, 0, 2, 3, 3, 0, 3]) returned 6129.9152578191 instead of the expected: 2.1224489796

and i get output of this code: 334.071005917
None

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
variance = variance / len(scores)
return variance

#2

Hi, @hubertsiwy ,

Should you be accessing the global variable, grades, within the grades_variance function here? ...

What if we wanted the compute the variance for a different set of grades? Consider the role of the function parameter, scores.

#3

True, my mistake there. but it did not help...
Your coment make me think and I change argument grade to score also in line 14 and 15. And it work fine now. Thank You.

Bot I don't understand why I have to change the code that was given from codeacademy? I thought I have to only write code below at 18 line as it was said in instruction

#4

The code that was given when you began Exercise 7. The Variance probably carried over from the previous exercises.

The important issue here was to make sure that you made proper use of the function parameters.