Variance can't go ahead with a intern challange | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Variance can't go ahead with a intern challange

Hi, I need help with this challange. Whit this values i have to use Python code to calculate variance the result using the corresponding equation. I think my code is correct but sololearn no... what do you think? Thanks!! valores = [0, 8, 8, 9] media = (0 + 8 + 8 + 9 )/20 total = 0 for valor in valores: total += (valor - media)**2 c = total / media print (c)

29th Oct 2022, 12:29 AM
Nicolas Parera
Nicolas Parera - avatar
1 Answer
+ 4
In the last step you are dividing by the mean, but you should divide by the number of elements (in this case 4)
29th Oct 2022, 3:26 AM
Tibor Santa
Tibor Santa - avatar