Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. (20 points) In this investment problem, you are given $T, which is the total amount you can invest on n different products. Product x

image text in transcribed

5. (20 points) In this "investment" problem, you are given $T, which is the total amount you can invest on n different products. Product x (x is a number between 0 and n-1) has a cost, c[x] and a profit p[x]. The goal is to maximize the profit without spending more than $T. Example: Product Cost Profit 24 24 10 10 18 7 If T 24, the best investment is to spend $20 (out of $24) to buy products B and C and make $36 in profit The APl of your program looks like this: def invest(T, Costs, Profits): # return a number, which is the best profit you can make. You will have to do two things: Explain vour strategy cleanly and neatly in English. Write a Python program to implement your strategy. . Points will be given based on the soundness of your strategy and a faithful implementation of that strategy. If your strategy always gives the best investment, that's great. You will get all points. In case your strategy does not always give the best investment, you still get 90% of the points if you describe a sound strategy and your implementation reflects that strategy

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions

Question

What would you do if the bullies were in your classes?

Answered: 1 week ago

Question

How many moles of water are there in 1.000 L? How many molecules?

Answered: 1 week ago