def z_score_list(data): if is_valid(data): tmp = [] u = mean(data) s = standard_deviation(data) for x in data: tmp.append(z_score(x, u, s)) return tmp else: raise TypeError("Data contains non-numeric values")
def variance(data): if is_valid(data): size = len(data) x = mean(data) tmp = [] for i in data: diff = subtract(i, x) tmp.append(square(diff)) total = add_list(tmp) return divide(total, size) else: raise TypeError("Data contains non-numeric values")
def standard_deviation(data): if is_valid(data): var = variance(data) return get_square_root(var) else: raise TypeError("Data contains non-numeric values")
def mode(self, data): if is_valid(data): self.result = mode(data) return self.result else: raise TypeError("Data contains non-numeric values")