Question: Need help writing this in Python Sample Input (comments are not part of the file, they are added for clarification) 2 # 2 test cases
Need help writing this in Python

Sample Input (comments are not part of the file, they are added for clarification)
2 # 2 test cases
3 # 3 items for test case 1
72 17 # P and W of item 1 (case 1)
44 23 #P and W of item 2 (case 1)
31 24 # P and W of item 3 (case 1)
1 # 1 family member (case 1)
26 # max weight for family member 1 (case 1)
6 # 6 items for test case 2
64 26 # P and W of item 1 (case 2)
85 22 #
52 4
99 18
39 13
54 9
4
23
20
20
36
Sample Output (in some cases, there are multiple solutions, providing only one of these solutions is enough)
Test Case 1
Total Price 72
Member Items
1: 1
Test Case 2
Total Price 568
Member Items
1: 3 4
2: 3 6
3: 3 6
4: 3 4 6
Acme Super Store is having a contest to give away shopping sprees to hicky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however each person can only take one of each type of item For example, one family member can take one television, one watch and one toaster, while another family member can take one television, one camera and one pair of shoes. Each item has a price (in dollars) and a weight (in pounds) and each person in the family has a limit in the total weight they can carry. Two people cannot work together to carry an item Your job is to help the families select items for each person to carry to maximize the total price of all items the family takes. (a) Write an efficient algorithm (verbal description and pseudo-code) to determine the maximum total price of items for each family and the items that each family member should select. (6) What is the theoretical running time of your algorithm for one test case given N items, a family of size F, and family members who can carry at most Mi pounds for 1 sisF. (c) Implement your algorithm by writing a program named "shopping. The program should satisfy the specifications below. Input: The input file named "shopping.txt" consists of T test cases T(1 ST
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
