Question: 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 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

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 Butter

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!