There are no errors in my code. I think Codecademy may be using the wrong formula when calculating the standard deviation. I'm not 100% sure so input would be appreciated. I'm sure there's some small reason as to why the formula codecademy is using is correct but I'm just not able to catch it. Here's a picture of the formula I see in youtube exercises
When looking up tutorials of how to calculate the standard deviation, i noticed that the actual formula had an extra bit of info that the exercise doesn't have (n-1). n =Sample size, which is the same as len(scores) in the code. Anyone have an explanation of why we aren't removing 1 item like the formula asks? Thanks.
def grades_variance(scores): average = grades_average(scores) variance = 0 for score in scores: variance += (score - average)**2 variance = variance / len(scores) # the confusion is here. i think there should be an extra -1 as this only calculates "n" return variance