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]
3 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]3 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
William would like to sort a list of items after the data is already entered.
harkovskaia [24]
The symbol method is not an available sort option.
8 0
3 years ago
Pls help me computer science discoveries
lara31 [8.8K]

Answer:

jdinwoahdjsioadjsakodsiaohdeioajfnsohfujkdshksyfneowjdfikdjiadjsadhnsuidghaiudbnha

Explanation:

3 0
3 years ago
Select the correct answer.
tangare [24]

Answer:

A. noise reduction

Explanation:

noise reduction reduces the loud sounds and makes it low, also noted that the low sounds are kept the same meaning its definitely noise reduction.

Extra's:

  • amplify - increases the strength of a sound.
  • compress - makes and affects both low and high sound by making them averagely high
  • normalise - to get the maximum volume.
3 0
2 years ago
Explain the theory of electro-magnetism
solong [7]
Electro magnetism theory cover the basic principle of electro magnetism : experimental basis.
Electromagnetism is defined as an attraction between two partical.
3 0
3 years ago
Which key retains its uniqueness even after you remove some of the fields?
Natasha_Volkova [10]

Answer:

Primary key retains its uniqueness even after you remove some of the fields.

Explanation:

I am assuming that this question is related to database. Therefore, I am answering it according to database context.

In database, you can have multiple rows and columns. Each column shows a specific attribute while each row plots the data according to the attributes. However, there is the first column of each of main table that has unique set of values. It is called the Primary Key. Some key features of primary key are:

  • It always contains the unique value.
  • Its value cannot be null.
  • A table can have at max one primary key.
  • It can be the combination of multiple columns but it must be unique.

Therefore, the primary key has the ability to retain its uniqueness even after you remove some of the fields.

8 0
4 years ago
Other questions:
  • Los antivirus no son infalibles y en ocasiones pueden darnos :
    10·1 answer
  • What need did anti lock brakes address?
    10·1 answer
  • Colin is a software developer. He would like to earn a credential that demonstrates to employers that he is well educated on sof
    15·1 answer
  • What is the most likely reason that a digital artist would use a program such as Autodesk Maya or Max to create 3-D images for a
    12·1 answer
  • What does a GPA show
    14·2 answers
  • How much tabs can you open with 8GB of ram? ​
    6·1 answer
  • Computing devices translate digital to analog information in order to process the information
    12·1 answer
  • The capacity of your hand drive is measured in​
    12·1 answer
  • Which of the following statements is true for plotly?
    8·1 answer
  • us refe rence: so 1 ac 2 2. describe the applications for merged documents in terms of the following benefits 2. describe the ap
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!