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
Write a C program that displays your name and address (or if you value your privacy, a frictionless name and address)
rosijanka [135]

Answer:

Following are the program in c language

#include <stdio.h> // header file

int main() // main method

{

   char name[90]="mantasa"; // storing name

   char add[90]="120 lal bangla mumbai"; // storing address

    printf("\n Name:%s\nAddress:%s",name,add); // print name and address

   return 0;

}

Output:

Name:mantasa

Address:120 lal bangla mumba

Explanation:

In this program we are declaring the two array of char type which will store the name and address . after that we display name and address.

7 0
3 years ago
PLEASE HELP!!
Anika [276]

Answer:

the answer is true

hope it helps

7 0
3 years ago
Read 2 more answers
CAD software is used to_____. / create a printed document to send through a fax machine / enhance a photograph / design a buildi
Umnica [9.8K]
CAD software is used to design a building.
4 0
2 years ago
Read 2 more answers
An IT systems engineer creates a new Domain Name System (DNS) zone that contains a pointer (PTR) resource records. Which zone ty
irina1246 [14]

Answer: Reverse DNS zone

Explo: a reverse DNS zone needs a PTR record since it is in charge of resolving the IP address to a domain or a hostname.

5 0
2 years ago
In the information systems (IS) department, the ________ group manages the process of creating new information systems as well a
Elodia [21]

Answer:Operations

Explanation:Information system is the system that provides the knowledge about the technology and other related component working with the people.It has the function that help in the information and the communication technology.It has several function like analysis of the data, keeping record , processing etc.

The technique through which the data of the information system is managed and processed is considered in the category of the operations.Operation task manages the information that is previously stored as well as the current information.

5 0
3 years ago
Other questions:
  • What should you do when an error message pops up on the screen?
    7·2 answers
  • Which best describes IMEI?
    5·1 answer
  • Select the correct answer.
    5·2 answers
  • Explain in your own words how remote-access Trojans (RATs) work. How can these be used by attackers? How would a network adminis
    10·1 answer
  • A technician has been dispatched to a customer site to diagnose an issue where the computer turns off intermittently. Upon arriv
    11·1 answer
  • Malwar is the short form for malicious software and used to refer​
    14·1 answer
  • Which composer below was not part of the classical period? <br> A. Beethoven B. Bach<br> C. Mozart
    6·1 answer
  • 1. Why is photographing lightning a difficult process?
    11·2 answers
  • The use of Quick Styles is a great way to save
    15·1 answer
  • The idea that an object can exist separate from the executing program that creates it is called
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!