Question: Using python 3 write a function, triple_sum(num_lst, target), that takes in a list of distinct integers, num_lst, and an integer, target. triple_sum should print all
Using python 3 write a function, triple_sum(num_lst, target), that takes in a list of distinct integers, num_lst, and an integer, target. triple_sum should print all sets of three distinct integers in num_lst that sum to target. Be sure that you only print each combination once: 0+7+2 is not a distinct combination from 7+0+2. triple_sum should then return the total number of distinct combinations found that sum to the target.
Examples (text in italics is printed, text in bold is returned):
>>> triple_sum([0, -12, 2, 7, -3, 4, 6, -2, 8], 5)
0 + 7 + -2 = 5
0 + -3 + 8 = 5
2 + -3 + 6 = 5
3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
