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
What keyword do we use to tell Java to set aside memory to create an object?
Pavel [41]

Answer: You reserve memory locations for an array when you _____.

use the keyword new

5 0
3 years ago
Which of the following two operating systems are used most frequently on tablets? Select one: A. Android and iOS B. BlackBerry a
zhuklara [117]

Answer:

A. Android and iOS

Explanation:

The two most frequently used operating systems on the tablets are Android and iOS. They are most famous operating systems currently. ios is used by apple hence it's tablets also known as ipads are on ios and other companies like samsung,motorola ,lenovo,hp etc. uses Android operating system on tablets.

4 0
3 years ago
Read 2 more answers
testout You want to prevent users in your domain from running a common game on their machines. This application does not have a
Margarita [4]

Answer:

Hash condition is the correct answer to the following question.

Explanation:

Hash condition provided more security than the applocker file path rule and it is manually for the files.

  • It is more secure than the path rule because each file has its separated hash condition.
  • Drawback of hash file is every time whenever when file is updated then we have to update the file hash condition.
8 0
3 years ago
In this HTML coding how do I change the second paragragraph size. pls pls can you explain me. pls pls​
Temka [501]

Answer:

instead of <p>, do something like <h3>, <h4>, <h5>, or <h6>. you can also apply a style to your html

Explanation:

6 0
2 years ago
What is the main purpose of an electronic career portfolio
lawyer [7]
The correct answer would be: C. To provide potential employers with a complete digital representation of your abilities, skills, capabilities, knowledge, and qualities

I hope that this helps you !
3 0
3 years ago
Read 2 more answers
Other questions:
  • ________ is the relative value, either in monetary terms or in overall impact, of the resource being protected by the access con
    14·1 answer
  • Why when I move stuff in Roblox Studio like an object or a Character. It tilts the opposite direction I'm moving it to with the
    6·2 answers
  • Explain the following terms as used in word processin
    9·1 answer
  • in python, using the simplest form the print_seconds function so that it prints the total amount of seconds given the hours, min
    10·1 answer
  • Your first submission for the CIS 210 Course Project should include the following functionality: - Requests the user to input hi
    13·1 answer
  • Which local folder temporarily stores all outgoing emails until the email program successfully sends them to a recipient?
    8·2 answers
  • Look at the options below. Which one is a simulation?
    15·1 answer
  • Readable code includes the use of
    10·2 answers
  • Which of the following described a global network connecting billions of computers and other
    10·2 answers
  • Convert<br> 0.625 to binary
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!