How calculate variance?
Hello everyone, could you please where is there mistake. Text of task: Using the same vaccinations dataset, which includes the number of times people got the flu vaccine. The dataset contains the following numbers: never: 5 once: 8 twice: 4 3 times: 3 Calculate and output the variance. We will soon learn about easier ways to calculate the variance and other summary statistics using Python. For now, use Python code to calculate the result using the corresponding equation. My code: vac_nums = [0,0,0,0,0, 1,1,1,1,1,1,1,1, 2,2,2,2, 3,3,3 ] #ваш код accum = 0 count = 0 for i in vac_nums: count = count + 1 accum = accum + 1 avg = accum / count variance = 0 for i in vac_nums: variance = variance + (avg - i)**2 variance = (variance / count) print(variance)
1/16/2022 12:10:36 PMLyapunov Alexander
2 AnswersNew Answer