1. Engineering
  2. Computer Science
  3. could you help me revise both of thesethank you very...

Question: could you help me revise both of thesethank you very...

Question details
Could you help me revise both of these?Thank you very much!
Question 3b: Three Subset Sum (4 points) Write a function three subset sum()that determines if there are at most three numbers in the given list that L contains no duplicate values. that sum to numbers.Assume See the test cases for examples. In (221s def three subset sun(L, n) subset-False for x in range(len(L)) for y in range(x) comparing every two numbers sum with subsetTrue break if subsetTrue: break reture subset Your code here In 1231 three subset aum(1,2,3.41,5)re Out (231 True In 124)1 three subset sum(t-2, 5, 5, 21)Te out(2411 False In 125) three subset su(1-2,,5, 2),True Out(25]: False In 126) three subset sum(t-1, 10, ,21, 8)-als Out( 261 True In HIDDEN TESTS In [ ]: 1, HIDDEN TESTS In I Ji HIDDEN TESTS
Question 3a: Pair Sum (2 points) Write a function pairSum( For example: (1, n) that determines if there are any two numbers in the list 1 that add ton pairSun t1,2, 31, 5) should retum True, since 2+3-5. pairsumt, 2, 31, 6) should retum False since there are no two numbers that add to 6 pairSum(11, 2, 3, 3,6)should return True because there are two 3s in the list which sum is 6 In (51 def pairsum(1, n)s def pairsum(1, leng-len(1) for i in range(,leng) if 11+1131 tlag-1 it flagi return True elsei return Palse Your code here out[6): True In 17] pairsum((1, 2, 21, 4)rue out(7): True In 1811 pairsum([1, 2, 31, 6False Out(811 False
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution