1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Margaret [11]
2 years ago
7

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}
Computers and Technology
1 answer:
Elena L [17]2 years ago
6 0

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.

You might be interested in
What are the importance of Help and Support feature of Windows​
Tema [17]

Answer:

Explanation:

Start Menu Returns. It's what Windows 8 detractors have been clamoring for, and Microsoft has finally brought back the Start Menu. ...

Cortana on Desktop. Being lazy just got a lot easier. ...

Xbox App. ...

Project Spartan Browser. ...

Improved Multitasking. ...

Universal Apps. ...

Office Apps Get Touch Support. ...

Continuum.

7 0
2 years ago
While engineers work to create computers that can understand us emotionally, ________ are also evolving toward a more human appe
aleksandrvk [35]
While engineers work to create computers that can understand us emotionally, ________ are also evolving toward a more human appearance.

affecting computing techniques
8 0
3 years ago
Suppose Alice, Bob, and Carol want to use secret key technology to authenticate each other. If they all used the same secret key
HACTEHA [7]

Answer:

No. This is not more secure.

Explanation:

this is not more secure than having all of Carol, bob and Alice having the same key.

alice would be able to know Carol's key for her to be able to verify the answer Carol gave to a challenge by her. she would also have to know bob's key to do the same.

any of these 3 would have to know someone else's secret key to verify answers to any challenge.

the challenge is to know the secret keys if the other two and if done, decryption can easily be done and they can impersonate.

8 0
3 years ago
An internal conflict is generally harder to write and still harder to convey in an interactive computer game
Tanya [424]
True, because of how the human mind works, you could have a fairly hard decision that could affect your life. So, An Internal conflict is more difficult to convey in an interactive computer game.
7 0
3 years ago
Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two
Alexeev081 [22]

Answer:

In Python:

cprice= int(input("Current price: "))

lmonth= int(input("Last month's price: "))

print("This house is $"+str(cprice))

print("The change is $"+str(cprice-lmonth)+" since last month")

print("The current mortage $"+str((cprice * 0.051) / 12)+" since last month")

Explanation:

Get current price

cprice= int(input("Current price: "))

Get last month's price

lmonth= int(input("Last month's price: "))

Print the current price

print("This house is $"+str(cprice))

Print the change

print("The change is $"+str(cprice-lmonth)+" since last month")

Print the mortgage

print("The current mortage $"+str((cprice * 0.051) / 12)+" since last month")

8 0
3 years ago
Other questions:
  • Marcus just created a new folder specifically for his buisness records so he would like to move last months business transaction
    13·2 answers
  • The ____ dialog box in windows vista appears each time a user attempts to perform an action that can be done only with administr
    12·1 answer
  • So when i try to click on an assignment to answer it the ask a question thing pops up and i can't exit out of it. I've tried rel
    10·2 answers
  • An sObject named Application _c has a lookup relationship to another sObject named Position_c.
    12·1 answer
  • for what reason do some security professionals consider insiders more dangerous than outside intruders?
    8·1 answer
  • Write a function that is named times_ten and accepts a number as an argument. When the function is called, it should return the
    8·1 answer
  • What is the internet ?
    11·2 answers
  • How to Create a while loop
    6·2 answers
  • What do you consider to be the next big thing in "Small Systems" (technology, hardware, software, etc.) and why?
    10·1 answer
  • Hi who plays among us
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!