def standard_deviation(data): avg = mean(data) num_values = len(data) sd1 = 0 for num in data: sd1 = addition(sd1, squared(subtraction(mean, num))) return squarerooted(division(num_values, sd1))
def variance(val1, val2, val3, val4, val5, val6, val7, val8, val9, val10): try: variance_values = [ val1, val2, val3, val4, val5, val6, val7, val8, val9, val10 ] variance_float = [float(i) for i in variance_values] variance_mean = mean(*variance_float) variance_length = len(variance_float) x = 0 for i in variance_float: x = x + squared(i - variance_mean) return division(x, subtraction(variance_length, 1)) except TypeError: print("Median is a Number . Cannot Input Text")
def pvariance(val1, val2, val3, val4, val5, val6, val7, val8, val9, val10): try: pvariance_values = [ val1, val2, val3, val4, val5, val6, val7, val8, val9, val10 ] pvariance_float = [float(i) for i in pvariance_values] pvariance_mean = mean(*pvariance_float) pvariance_length = len(pvariance_float) x = 0 for i in pvariance_float: x = x + squared(i - pvariance_mean) population_variance = division(x, pvariance_length) return population_variance except TypeError: print("Population Variance is a Number . Cannot Input Text")
def square(self, a): self.result = squared(a) return self.result