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
The open items on your computer are displayed here.
koban [17]
The GUI or Graphical <u /><u></u><em />User Interface.
7 0
2 years ago
Hich chip contains the information necessary to start the computer system?
Sindrei [870]
The BIOS contains the information.
7 0
3 years ago
A business has recently deployed laptops to all sales employees. The laptops will be used primarily from home offices and while
lys-0071 [83]

C. OS hardening.

Making an operating system more secure. It often requires numerous actions such as configuring system and network components properly, deleting unused files and applying the latest patches.

The purpose of system hardening is to eliminate as many security risks as possible. This is typically done by removing all non-essential software programs and utilities from the computer.

5 0
3 years ago
Which of the following qualities are generally required of both managers and
professor190 [17]

Answer:

C

Explanation:

beacuse you need to be respectful and smart.

8 0
3 years ago
Lists and Procedures Pseudocode Practice For each situation, provide a pseudocoded algorithm that would accomplish the task. Mak
Andrei [34K]

Answer:

The pseudocoded algorithm is as follows:

Procedure sumOdd(lotsOfNumbers):

    oddSum = 0

    len = length(lotsOfNumbers)

    for i = 0 to len - 1

         if lotsOfNumbers[i] Mod 2 != 0:

              OddSum = OddSum + lotsOfNumbers[i]

Print(OddSum)

Explanation:

This defines the procedure

Procedure sumOdd(lotsOfNumbers):

This initializes the oddSum to 0

    oddSum = 0

This calculates the length of the list

    len = length(lotsOfNumbers)

This iterates through the list

    for i = 0 to len-1

This checks if current list item is odd

         if lotsOfNumbers[i] Mod 2 != 0:

If yes, the number is added to OddSum

              OddSum = OddSum + lotsOfNumbers[i]

This prints the calculated sum

Print(OddSum)

6 0
3 years ago
Other questions:
  • George is only familiar with VGA connector for monitors. What should you tell him are the main differences between VGA and DVI c
    8·1 answer
  • Help !!!!!
    9·1 answer
  • Please conduct some research and find an article on Security Threats and please provide link of the article.
    5·1 answer
  • Research and discuss the LAMP (Linux, Apache, MySQL, and PHP) architecture. What is the role of each layer of this software stac
    14·1 answer
  • Write a Java program that generates GUI (Graphical User Interface). Your program should provide labels and textfields to a user
    9·1 answer
  • Write HTML code for inserting an image "cricket.jpeg" in size 500 width and 400 height.
    12·1 answer
  • In this lab, you will build a system for package delivery services that provides different shipping options with specific price.
    6·1 answer
  • Please Help Me!!!!!!!!!!!!!
    5·1 answer
  • Write a program that uses the Purchase class in 5.13. Set the prices to the following: Oranges: 10 for $2.99 Eggs: 12 for $1.69
    11·1 answer
  • A program that organizes sequences of automated provisioning tasks. A. Application Packager B. Sequence Manager C. Sequence Logg
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!