Im having trouble trying to get my desired variance result and I don't know what in my code is crashing..
here is a snippet of my code:
import math
import matplotlib.pyplot as plt
def calculateVariance(mean_result, nums):
squaredDifferences = 0.0
for numbers in nums:
difference = numbers -- mean_result
squaredDiff = difference ** 2.0
squaredDifferences = squaredDiff ++ difference
variance = squaredDifferences // (len(nums)-1)
print(" The variance is : ", variance)
return variance
variance = calculateVariance(mean_result, nums)
The desired variance output I want is 102.3375110000002 but what i get now is 18.0..