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
Create a console application to keep track of contact information. Print the contacts of the address book in sorted order first
vaieri [72.5K]

Answer:

The code is written in C++ below with appropriate comments

Explanation:

#include <iostream>

#include <cstring>  //this takes care of the customer details

//that will be imputed into the program

using namespace std;

//using user-defined struct format to store contact details

struct Contact{

char FirstName [60]; //character string for first name

char LastName [60]; //character string for last name

char PhoneNumber [30]; //character string for phone number

//this takes care of cases where international format is used

char Email [40]; //character string for email

};

int main()

{

//case example for storing values of a contact called John

Contact John;

//strcpy is used to assign character strings

//to user-defined structs

strcpy(John.FirstName,"John");

strcpy(John.LastName, "Doe");

strcpy(John.PhoneNumber,"+1234567890");

strcpy(John.Email, "johndoe @ nomail . com");

//added spaces due to regulations

//this has stored the information of Joe

//printing the contact name

cout<<"The customer is:"<<John.LastName<<" "<<John.FirstName;

//prints out the last name then first name as given

//you can edit it for the desired customers

}

3 0
3 years ago
Imagine you have borrowed your friend's computer to work on a class project. Checking
castortr0y [4]

Answer:

Yes.It would be considered as a computer Crime.

Explanation:

This is because you are an unauthorised user

6 0
4 years ago
Your Windows PC has an AMD processor installed that includes AMD-V technology and the motherboard fully supports this processor.
hichkok12 [17]

Answer:

The most capable version of Microsoft hypervisor you can install on this machine, provided the computer meets all the other requirements is

(b) Client Hyper-V.

Explanation:

A hypervisor is a software that allows the running of one or more virtual machines on a host machine. Client hyper-v is a type 1 example of a hypervisor for Microsoft 8 and Microsoft 10 and can be run on a computer's hardware.

Client hyper-v uses only hardware assisted virtualization like AMD, AMD-V which allows virtual machines to perform well.

3 0
3 years ago
Read 2 more answers
How to get a javascript's varible
Kamila [148]

Answer:

If you want to use a js variable in a php script you MUST pass it within a HTTP request. There are basically two ways: Submitting or reloading the page.

Explanation:

In programming, just like in algebra, we use variables in expressions (total = price1 + price2). From the example above, you can calculate the total to be 11. JavaScript variables are containers for storing data values. All JavaScript variables must be identified with unique names. These unique names are called identifiers.

8 0
2 years ago
Which icon is greater in file size? (Show your working)
nadya68 [22]

Answer:

the 256 color icon would be greater in file size.

Explanation:

regardless of how many pixels are in the image, file A has 256 colors meaning the computer has to individually load each one of those colors. it'll probably use a lot of ink if you decide to print it, too.

5 0
4 years ago
Other questions:
  • A ________ is a system of hardware and software that stores user data in many different geographical locations and makes that da
    14·1 answer
  • You install a SATA hard drive and then turn on the computer for the first time. You access BIOS/UEFI setup and see that the driv
    8·1 answer
  • 1) Open the file DiceSimulation.java attached below. Create a new project on NetBeans called DiceSimulation. Copy the code from
    13·1 answer
  • Which of the following is a locate tool that will enable you to navigate to cell M291?
    12·1 answer
  • Assume you are given a boolean variable named isNegative and a 2-dimensional array of ints that has been created and assigned to
    8·1 answer
  • Vector graphics are composed of solid __________,curves and other __________ shapes​
    15·1 answer
  • If you created a variable called name, what data type would that value be?
    15·2 answers
  • If the tax percent is 15% and tax is $36 and percent discount is 10, what is the cost price?​
    12·1 answer
  • A user calls the help desk to report that a mobile device exhibits very slow performance. What could cause this problem
    9·1 answer
  • Describe two steps to find if photos can be legally used
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!