Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3 Part III: Grocery Shopping (20 points) Write a function shop () that takes the following arguments, in this order: 1. filename: a file
Python 3
Part III: Grocery Shopping (20 points) Write a function shop () that takes the following arguments, in this order: 1. filename: a file that you will need to input. The file contains many lines of grocery items and their cor responding prices. In each line, the format is: name of product,price per unit. For example, a line of the file might look like this: Pringles,1.48 Note: content like Pringles,1.48' is a string, so you will need to convert 1.48 to a floating-point number when calculating the total price. For example, float (, 148" ) would return the floating-point 48. In practice your code will pass a variable to float as an argument (not a literal string as shown here). Also, the quotation marks in the above example do not actually exist in the file - they are shown just to remind you that the file contains strings. 2. shopping.list: a string that represents a list of things that you want to buy during this shopping trip. The format is: name of product 1, how much 1 you want, name of product 2, how muclh CSE 101 -Fall 2017 Lab #7 Page 4 2 you want, etc.. . . For example: 'Pringles, 3,Butter,1' means you are buying 3 units of Pringles and 1 unit of ButterStep 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