Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the process_shopping_list() function that takes the name of a file (as a string) as its only parameter. The file in question contains a shopping

image text in transcribed

Complete the process_shopping_list() function that takes the name of a file (as a string) as its only parameter. The file in question contains a shopping list. Each line of the file describes an item and a price. The format of the file is as follows: l ShoppingList.txt - C:\Users\dazh001\Google Drive File Edit Format Run Options Window Help Cadbury Chocolate 4.99 Movenpick Ice-cream 12.99 25 Coca-Cola Cans 25.00 5kg Chicken Drumsticks 10.00 1.5kg Friskies Cat Food 7.99 The process_shopping_list() must return a tuple containing the number of items in the shopping list and the total price of the items (rounded to 2 decimal places) in that order. For example: Test Result Number of items: 5 Total price: 60.97 shopping_tuple = process_shopping_list("ShoppingList.txt") print("Number of items:", shopping_tuple[0], "Total price:", shopping_tuple[1])

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago