1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
daser333 [38]
3 years ago
12

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]))
Computers and Technology
1 answer:
enot [183]3 years ago
5 0

Answer:

tc.asserttalse can make product

You might be interested in
The number of worksheets a workbook can contain is limited to the ______ of your computer.
KiRa [710]
<span>The number of worksheets a workbook can contain is limited to the memory of your computer.
The computer memory denotes the </span><span>hardware integrated circuits in the computer. These circuits store information for immediate use in a </span><span>computer, for worksheets for example.</span>
6 0
4 years ago
On which tab can you find the margins button
insens350 [35]
In the tab key you alwAy use that to center
4 0
4 years ago
Read 2 more answers
Which of the following is a goal of summarizing? to quote the main idea of what you have read, giving credit to the original sou
Tanya [424]
<span>to review the most important supporting points from the original information I believe is the answer

</span>
7 0
3 years ago
Write the function prototype for a function called showSquare. The function should have a single parameter variable of the int d
xeze [42]

Answer:

void showSquare(int param){

}

Explanation:

In C++ programing language, this is how a function prototype is defined.

The function's return type (In this case Void)

The function's name (showSquare in this case)

The function's argument list (A single integer parameter in this case)

In the open and closing braces following we can define the function's before for example we may want the function to display the square of the integer parameter; then a complete program to accomplish this in C++ will go like this:

<em>#include <iostream></em>

<em>using namespace std;</em>

<em>void showSquare(int param);</em>

<em>int main()</em>

<em>{</em>

<em>    showSquare(5);</em>

<em>    return 0;</em>

<em>}</em>

<em>void showSquare(int param){</em>

<em>int square = param*param;</em>

<em>cout<<"The Square of the number is:"<<endl;</em>

<em>cout<<square;</em>

<em>}</em>

8 0
4 years ago
The memory management layer is the part of the kernel that serves out all memory allocation requests.
svetlana [45]
Most likely it’s False . But look it up just in case
4 0
3 years ago
Other questions:
  • By apply styles, _____________ formats are being applied each time.
    6·1 answer
  • The smallest unit of time in music called?
    6·2 answers
  • Modern car odometers can record up to a million miles driven. What happens to the odometer reading when a car drives beyond its
    8·1 answer
  • A compressed format featuring small file size and good quality that is commonly used for online videos and music videos is BIN.
    8·1 answer
  • Which type of element is , and what is the meaning of that element?
    14·1 answer
  • During executing of the ______ PR task, units regain control of IP and transfer physical custody to the reintegration team.
    6·1 answer
  • A _______ is a host that runs software to provide information, such as web content, to other hosts.
    11·1 answer
  • Unicode is a world standard to represent _________________
    10·1 answer
  • Create a method to search an un-ordered array of integers for a value, if the value is found return the index of its position in
    10·1 answer
  • Domestic refers to things that happen __________ of the united states
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!