Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i am not too sure what to do please help! Step 1. Compute the total cost at each store (Fareway and Costco) if purchased items

image text in transcribedimage text in transcribed

i am not too sure what to do please help!

Step 1. Compute the total cost at each store (Fareway and Costco) if purchased items in the unit values as given (you should get \$24.08 for Fareway and \$62.02 for Costco). # replace the 0 in the following lines with your solution (keep the variable names the same) fareway_total_cost = 0 costco_total_cost = 0 fareway_total cost = sum(prices_fareway) costco_total_cost = sum(prices_costco) [15] print("fareway_total_cost=", fareway_total_cost) print("costco_toal_cost=",costco_total_cost) 0.25 fareway_total_cost= 24.88 costco_toal_cost= 62.02 Python # check your answer: import pytest assert fareway_total_cost == pytest.approx (24.08) assert costco_total_cost == pytest.approx (62.02) 0.15 [16] Python Step 2 Compute two new arrays: a Fareway price/unit array and a Costco price/unit array. # replace the following two lines with your solution (keep the same variable names) fareway_price_per_unit = np.empty_like(prices_fareway) costco_price_per_unit = np.empty_like(prices_costco) fareway_price_per_unit = prices_fareway/unit_values_fareway costco_price_per_unit = prices_costco/unit_values_costco Jupyter Server: local Cell 37 of 38 . lec02_IntroToPython Parti.ipynb Extension: Jupyter Notebook Renderers art | > Mt Assignment > M+Step 4. >print(f'Recall Fareway total: ${fareway_total_cost: 2f}') e costco_price_per_unit = unit_values_fareway = 0 for i in range(len(items)):e farew... + Code + Markdown > Run All Ex Clear Outputs of All Cells Restart Interrupt @ Variables E Outline .. base (Python 3.9.7) ILES T- Ideeway-PILLE_PI-UILL print(items[i]) else: None S [56] 0.4s Python Item(s) with a better value at Fareway: oatmeal S $ Step 4. While Costco often has unit values that are larger than those at Fareway (because you by more of an item), for purposes of comparison, let us pretend like we could purchase items at Costco with the same unit values as those at Fareway. For example, instead of purchasing 24 applesauce cups for ($9.89, let us suppose that we can purchase 4 applesauce cups for \$1.65 (the price per unit cost ($9.89/24) times the 4 cups). We will call this the "costco-equivalent" price for the item (Fareway unit values; Costco prices). In this step, you should compute the costco-equivalent prices for all of the items and compute/display the total (you should get \$16.30). You should then display the amount you would save by purchasing the items at Costco (you should get \$7.78). (You may use any of the arrays already $ computed above.) D D D E O D print(f 'Recall Fareway total: ${fareway_total_cost:.2f}') costco_price_per_unit = unit_values_fareway = 0 for i in range(len(items)): fareway_total_cost =unit_values_fareway costco_price_per_unit [68] 0.35 Python Recall Fareway total: $0.65 5 [] Python 4 5 Jupyter Server: local Cell 37 of 38 0 Step 1. Compute the total cost at each store (Fareway and Costco) if purchased items in the unit values as given (you should get \$24.08 for Fareway and \$62.02 for Costco). # replace the 0 in the following lines with your solution (keep the variable names the same) fareway_total_cost = 0 costco_total_cost = 0 fareway_total cost = sum(prices_fareway) costco_total_cost = sum(prices_costco) [15] print("fareway_total_cost=", fareway_total_cost) print("costco_toal_cost=",costco_total_cost) 0.25 fareway_total_cost= 24.88 costco_toal_cost= 62.02 Python # check your answer: import pytest assert fareway_total_cost == pytest.approx (24.08) assert costco_total_cost == pytest.approx (62.02) 0.15 [16] Python Step 2 Compute two new arrays: a Fareway price/unit array and a Costco price/unit array. # replace the following two lines with your solution (keep the same variable names) fareway_price_per_unit = np.empty_like(prices_fareway) costco_price_per_unit = np.empty_like(prices_costco) fareway_price_per_unit = prices_fareway/unit_values_fareway costco_price_per_unit = prices_costco/unit_values_costco Jupyter Server: local Cell 37 of 38 . lec02_IntroToPython Parti.ipynb Extension: Jupyter Notebook Renderers art | > Mt Assignment > M+Step 4. >print(f'Recall Fareway total: ${fareway_total_cost: 2f}') e costco_price_per_unit = unit_values_fareway = 0 for i in range(len(items)):e farew... + Code + Markdown > Run All Ex Clear Outputs of All Cells Restart Interrupt @ Variables E Outline .. base (Python 3.9.7) ILES T- Ideeway-PILLE_PI-UILL print(items[i]) else: None S [56] 0.4s Python Item(s) with a better value at Fareway: oatmeal S $ Step 4. While Costco often has unit values that are larger than those at Fareway (because you by more of an item), for purposes of comparison, let us pretend like we could purchase items at Costco with the same unit values as those at Fareway. For example, instead of purchasing 24 applesauce cups for ($9.89, let us suppose that we can purchase 4 applesauce cups for \$1.65 (the price per unit cost ($9.89/24) times the 4 cups). We will call this the "costco-equivalent" price for the item (Fareway unit values; Costco prices). In this step, you should compute the costco-equivalent prices for all of the items and compute/display the total (you should get \$16.30). You should then display the amount you would save by purchasing the items at Costco (you should get \$7.78). (You may use any of the arrays already $ computed above.) D D D E O D print(f 'Recall Fareway total: ${fareway_total_cost:.2f}') costco_price_per_unit = unit_values_fareway = 0 for i in range(len(items)): fareway_total_cost =unit_values_fareway costco_price_per_unit [68] 0.35 Python Recall Fareway total: $0.65 5 [] Python 4 5 Jupyter Server: local Cell 37 of 38 0

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

Focuses strongly on achievement and success in self and others.

Answered: 1 week ago