Do I divide the total variance by the number of scores inside the loop?


#1

Question

Do I divide the total variance by the number of scores inside the loop?

Answer

The step asking you to divide the total variance by the number of scores should be done outside of the for loop, otherwise your number will be far smaller than it should be because you divide it at each step.
Calculating a variance involves squaring the distance from the average of each score, summing those up, and then, after all that, dividing the summed variance by the number of scores.
In pseudo code, the process looks like this:

set variance to 0
for each score:
  variance = (distance of score from average) squared
return variance / number of scores

And be sure to print the result of calling your function at the end!


FAQ: Learn Python - Exam Statistics - The Variance