Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Not too sure if i did this right, any help? lec02_IntroToPythonPartl.ipynb . Extension: Jupyter Notebook Renderers D.. 'art | > M4 Assignment > M+Step 4.
Not too sure if i did this right, any help?
lec02_IntroToPythonPartl.ipynb . Extension: Jupyter Notebook Renderers D.. 'art | > M4 Assignment > M+Step 4. > e print (f'Recall Fareway total: ${fareway_total_cost: 2f}') costco_price_per_unit = unit_values_fareway = 0 for i in range(len(items));e farew... + Code + Markdown > Run All = Clear Outputs of All Cells Restart Interrupt | Variables Outline -- 1. base (Python 3.9.7) [17] 0.55 Python Item Unit Name Fareway Price Fareway Price/Unit Costco Price Units Costco Price/Unit Units 4.0 0 ct 2.79 0.7 9.89 24.0 0.41 1 Ibs 1.77 3.0 1.49 3.0 0.5 2 OZ 2.67 10.8 0.59 0.25 0.25 7.99 55.0 applesauce_cup bananas cheerios cheese_shredded cookies_pepperidge_farm_milano crackers_graham 0.15 3 OZ 2.0 8.0 10.99 48.0 0.23 4 OZ 1.88 6.0 0.31 8.99 22.5 0.4 5 OZ 3.29 14.4 0.23 7.99 57.6 0.14 6 eggs_organic ct 4.89 12.0 0.41 6.39 24.0 0.27 7 oatmeal OZ 4.79 42.0 0.11 8.29 160.0 0.05 Step 3. Display the names of the item(s) for which the Fareway value is better (i.e., the price per unit is lower). (You will actually only find one item.) Hint: Consider using a for loop to compare the price-per-unit values (with range or zip). In any iteration where the Fareway value is lower, display the item. (If you are experienced with Python, there are other options as well, such as use of list comprehensions: see, for example, https://docs.python.org/3/tutorial/datastructures.html.) Aside: Example syntax for an if statement (also refer to the Python documentation: https://docs.python.org/3/tutorial/controlflow.html): a = 5 = b = 2 if (a > b): print ('a is larger') else: print ('a is not larger') print ("Item(s) with a better value at Fareway: ") #YOUR CODE HERE fareway_price_per_unit = ("0.7","0.59","0.25","0.25","0.31","0.23","0.41","0.11") items = ("applesauce_cup", "bananas", "cheerios","cheese_shreeded", "cookies_pepperidge_farm_milano","crackers_graham", "eggs_organic", "oatmeal") for i in rangel len(fareway_price_per_unit)): if (i > 6): items += fareway_price_per_unit print(items (i]) else: None Jupyter Server: local Cell 37 of 38 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started