Question: program is python pycharm Part VI: Grocery Shopping (20 points) In Python, a tuple is a collection similar to a list in that it is

 program is python pycharm Part VI: Grocery Shopping (20 points) In program is python pycharm

Part VI: Grocery Shopping (20 points) In Python, a tuple is a collection similar to a list in that it is an ordered collection of items. An important difference, however, is that a tuple is immutable - once created, a tuple cannot be changed. Also, tuples are denoted using parentheses instead of square brackets. As with lists, elements of a tuple are accessed using indexing notation. For example, given the tuple subjects - ('physics', 'chemistry', 'biology'), we could ac- cess the elements of the tuple using subjects[0]. subjects[1] and subjects [2). Write a function grocery shopping () that takes a list of tuples called items_purchased that represent CSE 101 - Spring 2020 Homework #2 items purchased at a grocery store. Each tuple contains three items, in this order: the name of the item to purchase the unit cost of the item in dollars the number of units desired The example tuple ("Juice', 3, 5) indicates that we bought 3 units of "Juice" at $5 apiece, for a total of $15 The purpose of the function is to determine and return the name of the item that cost the most to buy You may assume that each named item occurs once in the list. For example, we would not find two tuples that both have "Juice" as the item to purchase. Examples: Return Value Bread 'Eggs' Function Argument [Bread', 3, 3), (Eggs 2,333 1 (Milk', 5, 2), ('Butter', 4, 1), ('Juice', 1, 5), l'Eggs', 4, 3) [('Milk', 2, 2), ('Butter, 4, 1), ('Juice', 3, 5), ('Eggs', 4, 3) 1 [('Peas', 5, 2), ('Meat', 3, 13), ('Beer', 4, 12), (Ice cream', 3, 5), Eggs 3, 3) (Peas', 5, 2)) Juice Beer Peas Note: The quotation marks displayed in the example return values are there to emphasize that the return values are strings. Do not add quotation marks to the return values

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!