Question: Write a Python program that accepts a collection of items with its corresponding weights and values/profits. The objective is to choose and pick up the

Write a Python program that accepts a collection of items with its corresponding weights and values/profits. The objective is to choose and pick up the items in a bag such that the profit value is maximized, provided that the total weight of the items chosen does not exceed the weight capacity of the bag. The answer should specify which items were picked up which gave the maximum profit. Input : 6 // weight capacity of the bag 5 // number of items 42 f/item with weight, value details 24 37 19 26 Output: 00111 //choice of items Answer: (penalty regime: 0 %) Write a Python program which accepts a collection of points with their Cartesian coordinates. The objective is to choose the points which are part of a straight line. Declare the straight line only if more than 2 points are found to be collinear. The formula which shows the relation between the x and y coordinates of two points (A(x1,71) and B (x2,y2)) and the angle between them is tan = = (y2-y1)/(x2-x1) or, consequently, e = tan-1 ((y2-y1)/(x2-x1) ) Can be utilized by => math.degrees(math.atan(...)) after importing the math package 9 Input: //No. of points -37, -14, 11, 35, 59, 41, 53, 77, 34 Output: 012 234 l/Point 0, Point 1, Point 2 l/Point 2, Point 3, Point 4 //Point 5, Point 6, Point 7 567 Answer: (penalty regime: 0%) sty PC TU
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
