subject

Can someone please help me with this PYTHON problem! please answer with code! the only parts that you need to change have # YOUR CODE HERE Subset Product¶
This next one asks you to employ a common recursive pattern — that of computing all the subsets of a given set of things. In this problem, you are to determine whether or not an integer P>1P>1 can be compute as the product of any combination of a provided list of integers (where each factor f >0>0 can only be used once).
Examples:
given P=10P=10 , and the list [2, 3, 4, 5], we see that 2×5=102×5=10 , so the answer is yes
given P=81P=81 , and the list [2, 2, 3, 3, 4, 9], 3×3×9=813×3×9=81 , so the answer is yes
given P=100P=100 and the list [3, 4, 5, 8, 10], the answer is no
Complete the implementation of the recursive can_make_product, which returns True or False based on whether the argument p can be computed as the product of some subset of the list of integers vals.
In [ ]:
def can_make_product(p, vals):
# YOUR CODE HERE
raise NotImplementedError()
. . .
In [ ]:
# (5 points)
from unittest import TestCas
tc = TestCase()
tc. assertTrue(can_make_product(10, [2, 5]))
tc. assertTrue(can_make_product(10, [2, 3, 4, 5]))
tc. assertTrue(can_make_product(10, [3, 4, 2, 5]))
tc. assertTrue(can_make_product(10, [10]))
tc. assertTrue(can_make_product(81, [2, 2, 3, 3, 4, 9]))
tc. assertTrue(can_make_product(66402, [2, 4, 5, 12, 17, 25, 31, 63]))
tc. assertFalse(can_make_product(10, [2, 2, 2, 4]))
tc. assertFalse(can_make_product(243, [2, 2, 3, 3, 3, 4, 4, 4]))
tc. assertFalse(can_make_product(81, [2, 3, 5, 9, 11]))
tc. assertFalse(can_make_product(100, [3, 4, 5, 8, 10]))
tc. assertFalse(can_make_product(12369, [3, 4, 5, 8, 19, 20, 31]))

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 13:00
Think of a spreadsheet as a giant calculator spread of paper chart data collector
Answers: 2
question
Computers and Technology, 24.06.2019 14:00
In the microsoft® access® and microsoft excel® programs, the ribbon contains tabs that are divided into with like tools in them. parts groups containers bunches
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Your is an example of personal information that you should keep private.
Answers: 2
question
Computers and Technology, 24.06.2019 22:30
Distinguish between a skill resume and a chronological resume and explain when it is best to use each format
Answers: 1
You know the right answer?
Can someone please help me with this PYTHON problem! please answer with code! the only parts that yo...
Questions
question
Biology, 10.09.2021 03:20
question
Mathematics, 10.09.2021 03:20
question
Social Studies, 10.09.2021 03:20
question
Health, 10.09.2021 03:20
question
Social Studies, 10.09.2021 03:20
question
Mathematics, 10.09.2021 03:30
Questions on the website: 13722362