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
Which one of these tasks best describes the process of localization?
mash [69]

Answer:

Localization is the process of adapting the project and service at a particular language.

Explanation:

Localization is that adapted to the product and service that need a desired to the popular look and feel.

Localization is to perform that including changing the local culture.

Localization is addition to perform the such details and time zone ,local color, holiday and name translation, money all to be considered.

Localization can sometimes  be perform with automatic language translation.

Localization that requirement to the enabling product to be different national product known as globalization.

5 0
3 years ago
Web-based application software is software that ________.
d1i1m1o1n [39]
Web-based application - this is a special kind of applications that operate in the global Internet via HTTP. The user interacts with the program, usually carried out through the browser.
8 0
3 years ago
Mobile devices have their own OSs, tailored to their handheld needs, which means they are not immune to what?
NikAS [45]

Answer:

Malware

Explanation:

Malware is used in many types of software included handheld OS's

6 0
2 years ago
Endnotes are indicated by
V125BC [204]

Answer:

The answer is D because u have the uppercase letter bold

4 0
2 years ago
Read 2 more answers
Name at least TWO kinds of gaming experiences that are possible with these new control devices but were not possible on original
Pie

Yes the ansewer is c bc you can look it up!


6 0
3 years ago
Other questions:
  • It's time for you to schedule a dental checkup. The responsible thing to do is to ___
    11·1 answer
  • To create a new query in Design view, click CREATE on the ribbon to display the CREATE tab and then click the ____ button to cre
    9·1 answer
  • Which devices typically generate computer output ?
    8·2 answers
  • What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y =50; if ( x >=
    7·2 answers
  • Add a new row to a table by clicking in the
    10·1 answer
  • The term phreaker is now commonly associated with an individual who cracks or removes software protection that is designed to pr
    13·2 answers
  • When importing data using the Get External Data tools on the Data tab, what wizard is automatically
    11·1 answer
  • KAPWING Video Editing Software allows you to use existing You Tube Videos in your design.
    8·1 answer
  • What is a phone made out of dna
    15·1 answer
  • Select the three subjects studied in sports biomechanics.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!