Пример #1
0
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
Пример #2
0
def test_02_task_330_minus_last():
    with pytest.raises(TypeError):
        minus_last('abc')
Пример #3
0
 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})
Пример #4
0
def test_06_task_330_ideal():
    with pytest.raises(TypeError):
        minus_last({
            6,
        })
Пример #5
0
def test_01_task_330_minus_last():
    assert minus_last(6) == 6
Пример #6
0
def test_07_task_330_minus_last():
    with pytest.raises(TypeError):
        minus_last((8, ))
Пример #7
0
def test_05_task_330_minus_last():
    with pytest.raises(TypeError):
        minus_last([8])
Пример #8
0
def test_04_task_330_minus_last():
    with pytest.raises(TypeError):
        minus_last({4: 1})