Exemplo n.º 1
0
def integratedLevel(numbers: str, sublength: int):
    from probs.prob02_algospot_pi.pi import subSameNumber, subSimpleIncrease, \
        subSimpleDecrease, subRotate, subArithmeticSequence

    if subSameNumber(numbers, sublength):
        return 1

    if subSimpleIncrease(numbers, sublength):
        return 2

    if subSimpleDecrease(numbers, sublength):
        return 2

    if subRotate(numbers, sublength):
        return 4

    if subArithmeticSequence(numbers, sublength):
        return 5

    return 10
 def test_sub_8(self):
     self.assertEqual(subArithmeticSequence('1050', 3), False)
 def test_sub_7(self):
     self.assertEqual(subArithmeticSequence('1048', 3), True)
 def test_sub_6(self):
     self.assertEqual(subArithmeticSequence('1159', 3), True)
 def test_sub_3(self):
     self.assertEqual(subArithmeticSequence('113579', 5), True)
 def test_sub_2(self):
     self.assertEqual(subArithmeticSequence('11234', 4), True)