Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python: Create a two functions: first called grocery_cost(food), where food can be one item or a list of items from the stock and price

In Python:

Create a two functions: first called grocery_cost(food), where food can be one item or a list of items from the stock and price dictionaries, the second is called stock_check(stock_list) where a store manager can check if stock numbers are at a minimum value.

grocery_cost: loops through the argument food, notes the price, checks the stock, calculates and prints the total cost and changes the stock number. You will need to use a for statement to loop through the items in food and an if statement to check and update the stock (substract one from the stock for each item in the stock).

stock_check: loops through each item in the stock dictionary and uses an if-statement to print a statement if stock is less than 5.

Given:

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}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Image Databases Towards Advanced Image Retrieval

Authors: Yihong Gong

1st Edition

1461375037, 978-1461375036

More Books

Students also viewed these Databases questions

Question

What is the environment we are trying to create?

Answered: 1 week ago

Question

How can we visually describe our goals?

Answered: 1 week ago