Skip to content

Instantly share code, notes, and snippets.

View r0drigopaes's full-sized avatar

Rodrigo de Barros Paes r0drigopaes

  • UFAL
  • Brasil
View GitHub Profile
__author__ = 'Rodrigo Paes - rodrigo@ic.ufal.br'
import unittest
from statistics_faulty import stats
class MyTestCase(unittest.TestCase):
def test_stats(self):
l = [31]
my_map = stats(l)
self.assertEqual(31,my_map["min"])
def stats(lst):
_min = None
_max = None
freq = {}
for i in lst:
i = abs(i)
if _min is None or i < _min:
_min = i
if _max is None or i > _max:
_max = i
def stats(lst):
_min = None
_max = None
freq = {}
for i in lst:
if _min is None or i < _min:
_min = i
if _max is None or i > _max:
_max = i
if i in freq: