# python calculate variance by hand

# calculate mean m = sum(results) / len(results) # calculate variance using a list comprehension var_res = sum((xi - m) ** 2 for xi in results) / len(results)

**Here is what the above code is Doing:**

1. We create a list of the results of the experiment.

2. We calculate the mean of the results.

3. We calculate the variance of the results.

The variance is a measure of how far a set of numbers is spread out from their average value.

The variance is calculated as the average of the squared differences from the Mean.

To calculate the variance follow these steps:

1. Work out the Mean (the simple average of the numbers)

2. Then for each number: subtract the Mean and square the result (the squared difference).

3. Then work out the average of those squared differences.