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
Can someone help me answer this, I can’t fail tysm :)
nalin [4]
Don’t know what the answer is but do you, I have the test for that today
5 0
3 years ago
What are the names of the components (each shown with a leader and a line) of a circuit shown in the diagram?
Goryan [66]

Answer:

The name of the components of the given labelled circuit is:

The box like figure in the given image is the battery source from where the current drawn into the circuit.

A string connecting positive terminal of battery to the bulb is an electric wire through which current flows in the circuit.

A bubble like object in the circuit is a bulb which lights up when current moves through the circuit.

A component connected to the negative terminal of batter source is a switch.

Then open circuit is an open as the key of the switch is open.

8 0
2 years ago
Sheila is using a process of saving files to her desktop and then renaming them. She is
inessss [21]

Answer: D

Use the internet to search for a new app to rename the folder.​

Explanation:

Rename function is used to change the name of the file or directory i.e. from old_name to new_name without changing the content present in the file. This function takes name of the file as its argument. There are many alternatives to this in which Sheila can found out through the internet.

5 0
2 years ago
Read 2 more answers
Given an int variable k that has already been declared, use a while loop to print a single line consisting of 88 asterisks. Use
Grace [21]

Answer:

True

Explanation:

The while loop is going to be executed until the condition is false.

Since <em>k</em> is initially equal to 1, the loop will execute 88 times. One asterisk will be printed and <em>k</em> will be incremented by one during each iteration.

When <em>k</em> becomes 89, the condition will be false (89 is not smaller or equal to 88) and the loop will stop.

6 0
2 years ago
Create a new Java program called MyInfo. Create one or more method(s) that pass the following information as parameters and prin
Vladimir79 [104]

Answer:

Answered below

Explanation:

//Program in Java

class MyInfo{

public static void main (String args []){

myFullName("John", "Doe");

myAgeMajorGPA(20, "Biology", 4.3);

}

public void myFullName(String initialName, String middleName){

System.out.println(initialName);

System.out.print(middleName);

}

public void myAgeMajorGPA(int age, String major, double GPA){

System.out.println(age);

System.out.println(GPA);

System.out.print(major);

}

}

3 0
2 years ago
Other questions:
  • Select the most likely outcome of making only on-time minimum payments to a credit card with a balance for an entire year?
    7·2 answers
  • How many arguments are required for the sum function?
    15·1 answer
  • What does the merge &amp; center button in the alignment group on the home tab do?
    8·1 answer
  • What is a main cause of an aurora?
    8·1 answer
  • A large institution, such as a bank, may have thousands of transactions to process in which no user interaction is required; whi
    5·2 answers
  • Who found the first computer bug in 1947, and invented the concept of a compiler in 1952
    6·1 answer
  • Creating Classes
    10·1 answer
  • A monopoly is a market that has few competing businesses. many sellers of the same item. many sellers of a variety of products.
    8·2 answers
  • Help me with this two questions please
    15·1 answer
  • Which description best applies to a macro?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!