예제 #1
0
 def print_deviation_calculation(average_type, rows, average):
     variance = MathsUtil.arr_variance(rows, average)
     standard_deviation = MathsUtil.arr_standard_deviation(rows, average)
     print(f"For {average_type}: The Standard Deviation is {standard_deviation:.2f}, The Variance is {variance:.2f} and the {average_type} in {average:.2f}")
 def test_arr_variance(self):
     self.assertEqual(MathsUtil.arr_variance([1, 2, 3, 4], MathsUtil.arr_mean([1, 2, 3, 4])), 1.25)
     self.assertEqual(MathsUtil.arr_variance([-10, 1, 2, 3, 4], MathsUtil.arr_mean([-10, 1, 2, 3, 4])), 26)