def amicable() -> list: """ Finds all amicable numbers for a range of 200-300 :return: list with pairs amicable numbers """ amica_list = [] level_up = 0 for k in range(200, 300): level_up = level_up + 1 for j in range(200 + level_up, 300): if minus_last(k) == j: if minus_last(j) == k: amica_list = (amica_list) + [(k, j)] return amica_list
def test_02_task_330_minus_last(): with pytest.raises(TypeError): minus_last('abc')
def test_third_330_minus_last(self, divisor): self.assertEqual(6, minus_last(6)) self.assertRaises(TypeError, minus_last, 'opa4a') self.assertRaises(TypeError, minus_last, [4]) self.assertRaises(TypeError, minus_last, {8: 3}) self.assertRaises(TypeError, minus_last, {8, 3})
def test_06_task_330_ideal(): with pytest.raises(TypeError): minus_last({ 6, })
def test_01_task_330_minus_last(): assert minus_last(6) == 6
def test_07_task_330_minus_last(): with pytest.raises(TypeError): minus_last((8, ))
def test_05_task_330_minus_last(): with pytest.raises(TypeError): minus_last([8])
def test_04_task_330_minus_last(): with pytest.raises(TypeError): minus_last({4: 1})