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
In computer science how can you define "copyright, designs and patents act 1988"?​
Natali5045456 [20]

Answer:

:)

Explanation:

Copyright Designs and Patents Act

The Copyright Designs and Patents Act (1988) gives creators of digital media the rights to control how their work is used and distributed. ...

Anything which you design or code is automatically copyrighted and may not be copied without your permission, as the digital creator.

5 0
2 years ago
What would be the output of system.out.println("fun\tny");
netineya [11]

Answer:

use google

Explanation:

8 0
3 years ago
All the answers I've got is 0, which seems strange but I'm sure I'm following this algorithm correctly.
Salsk061 [2.6K]
I think its six. im not sure but it could be another on.                                                                     

7 0
3 years ago
What are the steps involved in accepting all the changes in a document?
I am Lyosha [343]
  1. you can accept or reject the changes one at a time or all at one time.
  2. click at the beginning of the document , and then on the review tab, click next to go to the first tracked change.
  3. Click Accept or reject to keep or remove the change.

Keep repeating the step 2 until you've reviewed all of the changes in your document.

*Hope this helps !!! Mark me Brainliest :)

7 0
3 years ago
Read 2 more answers
Mha ship what yo fave
Diano4ka-milaya [45]

Answer:

umm the first one I think..? lol

4 0
2 years ago
Read 2 more answers
Other questions:
  • Im trying to learn c# for unity does anyone know any good sources
    10·1 answer
  • Create a new file that contains a summary of the total consumption for three sectors: "Residential," "Commercial," and "Industri
    10·1 answer
  • Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison
    15·1 answer
  • A ____ is a statement specifying the condition(s) that must be true before the function is called.
    6·1 answer
  • If you were any type of fnaf charater who would you be and why?
    10·2 answers
  • _____ is the practice of using the internet to provide healthcare without going to a doctor’s office or hospital.
    15·2 answers
  • Examples of email prividers​
    6·2 answers
  • A(n) ____________________ key is a key that is not reused, but rather is only used once, thus improving security by reducing the
    5·1 answer
  • Which two keys are commonly used to move or insert data?.
    12·1 answer
  • Should a UDP packet header contain both Sour Port # and Destination Port #?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!