0
Why below code to calculate variation in standard deviation is failing
from math import sqrt players = [180, 172, 178, 185, 190, 195, 192, 200, 210, 190] sum = 0 for i in players: sum = sum + i avg = sum / len(players) var_list = [] for i in players: var_list.append((avg - i)**2) varianc = 0 for i in var_list: varianc = varianc + i variance_val = varianc / len(players) sd = sqrt(varianc) count = 0 hm = avg + sd lm = avg - sd for i in players: if (i >= lm) and (i <= hm): count +=1 print(count)
2 Antworten
+ 1
sd = sqrt(variance_val)
0
And your expected output is?