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)

11th Sep 2021, 11:56 AM
Balachander S
Balachander S - avatar
2 Respostas
+ 1
sd = sqrt(variance_val)
11th Sep 2021, 12:47 PM
Simba
Simba - avatar
0
And your expected output is?
11th Sep 2021, 12:15 PM
Tim
Tim - avatar