Question: how to write code in python please Part II: Order Up! (20 points) Write a function order lunches ) that takes two arguments, in this

how to write code in python please Part II: Order Up! (20points) Write a function order lunches ) that takes two arguments, inthis order: 1. stock: A dictionary that contains menu items available forpurchase at a restaurant. The dictionary maps items to an integer counthow to write code in python please

Part II: Order Up! (20 points) Write a function order lunches ) that takes two arguments, in this order: 1. stock: A dictionary that contains menu items available for purchase at a restaurant. The dictionary maps items to an integer count of how many of each item is available (e.g., ' soda' : 4). 2. orders: A list of strings representing items that patrons at the restaurant have ordered. The list might include items not available for purchase The function iterates over the orders list, treating each string in the list as a key in the stock dictionary. If the key is present in the dictionary, the function decrements the value associated with the key (provided that doing so would not make the value negative). The function also returns the total number of valid items purchased. The

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!