Question: For a given dictionary, named inventory, Inventory a purchase 'bag': [ ' apple ' , 'bread', 'milk' ] , pack'! [ ' canvas ' ,

For a given dictionary, named inventory, Inventory a purchase 'bag': ['apple', 'bread', 'milk'], pack'! ['canvas', 'paper', 'rope', 'loat') try to do the followings: * Add a key to inventory called 'pocket. Set the value of 'pocket' to be a list consisting of the strings: 'shell', berry, and 'mint' Remove("poper') from the list of items stored under the 'pock' key. Add 50 to the number stored under the 'purchase' key. Activity -2: Define the following two dictionaries: prices -(banana": 4, "apple*t 2, "orange": 1.5, "pear": J) stock -("banana" : 6, "apple"t 0, "orange"s 92, "pear", 15) Loop through euch key in prices. For euch key, print out the key along with its price and stock information. Print the answer in the following format: apple price: 2 stock: 0 Let's determine how much money you would moke if you sold all your food. Creole a voroble colled totoi and set it to zero.. Loop through the prices dietionaries. For eoch key in prices, multiply the number in prices by the number in stock. Print that value into the console and then add it to totol. Finally, outside your loop, print total 1[Page For the two dictionaries (stock and prices) you made in previous example, make a list called shopping_ list with the values: "banana" STOCK =1/ "apple"r "orange": 32, prices =( "apple": oranre 12.5 Define a function compute_ bill that takes one arguent food as input. in the function. crete a voriable total with on initial value of zero. While you loop through eoch item of food, only add the price of the item to total if the item's stock count is greater than zero. the item a in stock and ofter you odd the price to the fotol subtract one from the flem'

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!