One-line summary

In this exercise, you find 3 numbers on a list which add up to a given total.

Exercise description

The function add_up_3() is given two parameters, namely a list of positive integers numlist, and an integer total. The function should return three numbers from numlist which add up to total. The three numbers must all have a different index in numlist (so if, for instance, you return three numbers which are the same, that number should be at least three times in numlist).

You return the three numbers as a tuple. If no numbers can be found on the list which add up to the given total, you return (-1, -1, -1).

Examples

add_up_3( [1,2,3,4,5], 6 ) returns (1, 2, 3), as 1+2+3=6. You may return the numbers in a different order.

add_up_3( [2,4,5,7], 12 ) returns (-1, -1, -1), as no three numbers on the list add up to 12. Note that you should not return, for instance, (4, 4, 4) as 4 occurs only once in the list of numbers.

add_up_3( [4,1,4,7,4], 12 ) returns (4,4,4) or (4,1,7). You only need to return one of these answers, and you may return the numbers in a different order.