get variance of list python

def get_variance(arr):
    mean = sum(arr) / len(arr)
    summ = 0
    for x in arr:
        summ+=(x-mean)**2
    return summ/len(arr)

Here is what the above code is Doing:
1. We’re getting the mean of the array.
2. We’re subtracting the mean from each element in the array.
3. We’re squaring each element in the array.
4. We’re summing all the elements in the array.
5. We’re dividing the sum by the length of the array.