Answer:
stock_key={'tomato soup':20,'cheese':10,'milk':25,'oreos':100,'red bull':0,'apples':17,'oranges':4}
price_key={'tomato soup':1.85,'cheese':3.99,'milk':4,'oreos':7.49,'red bull':0.99,'apples':0.59,'oranges':1.29}
def grocery_cost(*args):
total_cost = 0
for arg in args:
if arg in stock_key.keys():
stock_key[arg] -= 1
total_cost += price_key[arg]
print( f"Total cost of groceries: {total_cost}")
def stock_check():
for key, value in stock_key.items():
if value < 5:
print(f"The stock \"{key}\" is less than 5.")
grocery_cost('apples', 'oranges','milk', 'oreos','cheese')
stock_check()
Explanation:
The functions of grocery_cost and stock_check are python defined functions. The former accepts a list of one or more items and calculates the total cost of the grocery items from the stock and price dictionary while the latter check the size of the stock in the food store.