Question: Could you use python3 to revise it Write a function pairSum(1, n) that determines if there are any two numbers in the list 1 that

Could you use python3 to revise it
 Could you use python3 to revise it Write a function pairSum(1,
n) that determines if there are any two numbers in the list

Write a function pairSum(1, n) that determines if there are any two numbers in the list 1 that add to n For example: pairSumet1, 2, 31, 5) should return True , since 2+3-5 pairSume, 2. 31. 6) should return Palse since there are no two numbers that add to 6. pairsum(t1, 2, 3, 31. 6),should return True because there are two 3s in the list which sum is 6 In 1: def pairSun(1, n) length-1en (1) for i in range (0,length): for i in range(length): if i-j return True else return Palse # Your code here In 1.11 pairSum(ti, 2. 21. 4) True Write a function three subset sun(L, s) that determines if that L contains no duplicate values there are at most three numbers in the given list I, that sum to number s. Assume See the test cases for examples. In (22]: def three subset sum(L, n): subset False for x in range(len(L)) for y in range(x)1 comparing every two numbers sum with s subset True break if subset True: break return subset your code here In 123]: three subset sum(11,2,3,41. 5)True out(23)1 True In [24]three-subset-aum(t-2, out (2414 False 5, 5, 2], 8) "" True In 12511 three subset sum ( 1-2. 8,5,21. 8)rue Out 1251 False In 1 10, 5, 2). False [26]. three-subset-sun( Out[26]: True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!