Question: question about python Write a function subsetsum, s) that determines if there are any two numbers in the list I that add to s. e.g,
question about python
Write a function subsetsum, s) that determines if there are any two numbers in the list I that add to s. e.g, for (1,2,3],5), it would be True, since 2 3 5 (1,2, 3], 6) would be false since there are no two numbers that add to six in the list (you cannot use the same value of three twice). On the contrary, if the input were (1, 2, 3, 3], 6), this would be true because there are two 3s in the list. In def subsetsum(1, s): # Your code here. return subset In [ ]: subsetsum([1, 2, 3), 5)-True Insubsetsum(, 2, 2], 4)True In subsetsum([l, 2, 3], 6) False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
