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

 Complete the process_shopping_list() function that takes the name of a file

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

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!