Answered step by step
Verified Expert Solution
Link Copied!

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 3image text in transcribed

image text in transcribed

image text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

How to reverse a Armstrong number by using double linked list ?

Answered: 1 week ago