Пример #1
0
 def testOnTuples(self):
     "Checks that methods also work on tuples."
     self.assertAlmostEqual(basic.mean(tuple(self.dataA)), self.meanA, 5)
     self.assertAlmostEqual(basic.mean(tuple(self.dataB)), self.meanB, 5)
     self.assertAlmostEqual(basic.stddev(tuple(self.dataA)),
                            self.stddevA, 5)
     self.assertAlmostEqual(basic.stddev(tuple(self.dataB)),
                            self.stddevB, 5)
Пример #2
0
 def testOnTuples(self):
     "Checks that methods also work on tuples."
     self.assertAlmostEqual(basic.mean(tuple(self.dataA)), self.meanA, 5)
     self.assertAlmostEqual(basic.mean(tuple(self.dataB)), self.meanB, 5)
     self.assertAlmostEqual(basic.stddev(tuple(self.dataA)), self.stddevA,
                            5)
     self.assertAlmostEqual(basic.stddev(tuple(self.dataB)), self.stddevB,
                            5)
from basic import mean, median, mode

_ = int(input())
arr = sorted(map(int, input().split()))

print(mean(arr))
print(median(arr))
print(mode(arr))
Пример #4
0
 def testBasicStats(self):
     "Test that the basic stats method works."
     meanA, stddevA = basic.basic_stats(self.dataA)
     self.assertAlmostEqual(meanA, basic.mean(self.dataA))
     self.assertAlmostEqual(stddevA, basic.stddev(self.dataA))
Пример #5
0
 def testMean(self):
     "Check that mean works as expected."
     self.assertAlmostEqual(basic.mean(self.dataA), self.meanA, 5)
     self.assertAlmostEqual(basic.mean(self.dataB), self.meanB, 5)
Пример #6
0
def least_squares(x, y):
  beta = correlation(x, y) * standart_deviation(y) / standart_deviation(x)
  alpha = mean(y) - beta * mean(x)
  return alpha, beta
Пример #7
0
 def testBasicStats(self):
     "Test that the basic stats method works."
     meanA, stddevA = basic.basic_stats(self.dataA)
     self.assertAlmostEqual(meanA, basic.mean(self.dataA))
     self.assertAlmostEqual(stddevA, basic.stddev(self.dataA))
Пример #8
0
 def testMean(self):
     "Check that mean works as expected."
     self.assertAlmostEqual(basic.mean(self.dataA), self.meanA, 5)
     self.assertAlmostEqual(basic.mean(self.dataB), self.meanB, 5)