Example #1
0
def find_trio_product(numbers: list):
    [low, mid, high] = find_sum_trio(numbers, 2020)
    return low * mid * high
Example #2
0
 def test_MiddleAndLast_SortRequired(self):
     numbers = [13, 11, 7, 1, 3, 2, 14, 5]
     backupNumbers = copy.copy(numbers)
     self.assertListEqual(find_sum_trio(numbers, 23), [2, 7, 14])
     self.assertListEqual(numbers, backupNumbers)
Example #3
0
 def test_PuzzleInput(self):
     numbers = [1721, 979, 366, 299, 675, 1456]
     self.assertListEqual(find_sum_trio(numbers, 2020), [366, 675, 979])
Example #4
0
 def test_MiddleAndLast(self):
     numbers = [1, 2, 3, 5, 7, 11, 13, 14]
     self.assertListEqual(find_sum_trio(numbers, 23), [2, 7, 14])
Example #5
0
 def test_NoPair(self):
     self.assertIsNone(find_sum_trio([1, 2, 3, 4, 5], -1))
Example #6
0
 def test_Last(self):
     self.assertListEqual(find_sum_trio([1, 2, 3, 4], 9), [2, 3, 4])
Example #7
0
 def test_First(self):
     self.assertListEqual(find_sum_trio([1, 2, 3, 4], 6), [1, 2, 3])
Example #8
0
 def test_EmptyList(self):
     self.assertRaises(ListTooShort, lambda: find_sum_trio([], 0))
     self.assertRaises(ListTooShort, lambda: find_sum_trio([0], 0))
     self.assertRaises(ListTooShort, lambda: find_sum_trio([0, 1], 0))