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
Phantasy [73]
3 years ago
11

Create a new file that builds a shopping list from a user. There should be a input query that asks the user to list an item and

the number of those items. Two lists should be built that reflects the items on the list and the number of each items that are to be purchased. The list should build until the user is done. b. Call up your function grocery_cost to check the stock and build your total cost. Your program should let the user know if the items they want are in stock. If there is not enough stock, your program should let the user know that and offer them the number that are in stock. You will need to edit your grocery_cost function to reflect that a number of items will be selected instead of just one. c. Call up your stock_check function and print items that need restocking

Computers and Technology
1 answer:
levacccp [35]3 years ago
7 0

Answer:

Check the output

Explanation:

# -*- coding: utf-8 -*-

"""

Created on Thu Apr 12 00:39:11 2018

author:

"""

stocks ={

       "tomato soup": 20,

       "cheese": 8,

       "bread": 6,

       "milk": 8,

       "butter": 7,

       "coffee": 8,

       "ice cream": 5,

       "orange juice": 12,

       "bacon": 6,

       "tortilla chips": 14,

       "ramen": 24 }

prices ={

       "tomato soup": 1.85,

       "cheese": 3.99,

       "bread": 2.50,

       "milk": 3.59,

       "butter": 1.99,

       "coffee": 5.99,

       "ice cream": 2.99,

       "orange juice": 2.50,

       "bacon": 5.49,

       "tortilla chips": 3.00,

       "ramen": 0.99 }

def grocery_cost(item_list,quantity_list):

   totalcost = 0

   for i in range(len(item_list)):

       totalcost=totalcost+(quantity_list[i]*prices[item_list[i]])

       

   return totalcost

def stock(item):

   print("Number of itmes present in the stock:",stocks[item])

print("Welcome to the on-line grocery store!!")

print("Items that are available for purchase:")

for key in stocks.keys():

   print(key)

#chosen foods

print("Enter the item with quantity or Enter 'Q' when you are done")

item_list=[]

quantity_list=[]

while True:

   item=input('Enter the item name: ')

   if item=='Q' or item=='q':

       break

   item_list.append(item)

   while True:

       quan=int(input('Enter the number of item: '))

       if stocks[item] >=quan:

           quantity_list.append(quan)

           break

       else:

           stock(item)

           print('Your requirement is higher than stock available. Please enter again!!')

print("\nTotal cost:", "$",grocery_cost(item_list,quantity_list))

Kindly check the output in the attached image below.

You might be interested in
A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
uysha [10]

Answer:

Security Tab is the correct answer.

Explanation:

The Security Tab will enable the users to authorize anyone to use that file or directory.Many clients deleted the security tab because After that nobody can alter the security privileges on the device.

  • With the help of the Security tab, we will minimize the ActiveX attacks on Internet Explorer. This option is available in the Internet Options of the dialog box.
  • Other options are incorrect because they are not related to a given scenario.
8 0
3 years ago
If you want to present slides to fellow students or co-workers,which productivity software should you use to create them?
Tamiku [17]
Just use prezi.com hope that helps.
6 0
3 years ago
Read 2 more answers
Which of the following tasks would least help an individual achieve a goal to safely lose weight?
ozzi
To continue to look at motivational or inspirational quotes to remind them or to remember how far you have come and it is not time to give up!
7 0
3 years ago
Read 2 more answers
Why is it important to recognize the proper boundaries or limits of algorithms?
Oduvanchick [21]

Answer:

D

Explanation:

DDDD no war\t

4 0
3 years ago
In order to identify the transmissions that belong to each VLAN, a switch will add a tag to Ethernet frames that identifies the
ira [324]

Answer:

True

Explanation:

Frame Tagging is a method Cisco developed to identify packets travelling through links also called VLAN Tagging.

8 0
3 years ago
Other questions:
  • In Linux, when logged in as a normal user with root privileges, which command must precede the apt-get command in the command li
    13·1 answer
  • When you include a word cover page in a multi page document, the cover page is not considered the first page. True or false?
    13·1 answer
  • Which part of the cpu stores instructions for high speed access or processing
    14·1 answer
  • Operational feasibility, which refers to user acceptance and support, as well as management acceptance and support, is also know
    9·1 answer
  • How can you efficiently restrict the read-only function of a requesting SNMP management station based on the IP address?
    14·1 answer
  • I don't know how to explain what is motion in my own words
    7·2 answers
  • Explain the impacts of computer in education
    6·2 answers
  • Your program will be used by many departments at the university. Your comments will be important to their IT people. What would
    15·1 answer
  • The address for the website you want to visit is called the browser internet URL World Wide Web
    5·2 answers
  • Three healthcare firms jointly own and share the same cloud resources to meet their computing needs. Which cloud model does this
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!