Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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' Removepoper from the list of items stored under the 'pock' key. Add to the number stored under the 'purchase' key. Activity : Define the following two dictionaries: prices banana: "applet "orange": "pear": J stock banana : "apple"t "orange"s "pear", 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: stock: 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 Page For the two dictionaries stock and prices you made in previous example, make a list called shopping list with the values: "banana" STOCK "apple"r "orange": prices "apple": oranre 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started