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
astraxan [27]
2 years ago
12

Write a program that keeps track of a simple inventory for a store. While there are still items left in the inventory, ask the u

ser how many items they would like to buy. Then print out how many are left in inventory after the purchase. You should use a while loop for this problem. A sample run is below.
(CodeHS, PYTHON)
Computers and Technology
2 answers:
neonofarm [45]2 years ago
4 0

Answer:

STARTING_ITEMS_IN_INVENTORY = 20

num_items = STARTING_ITEMS_IN_INVENTORY

# Enter your code here

while num_items > 0:

print("We have " + str(num_items) + " items in inventory")

toBuy = int(input("How many would you like to buy?"))

if toBuy > num_items:

print("There is not enough in inventory")

print("Now we have " + str(num_items) + " left")

else: # ok to sell

num_items = num_items - toBuy # update

if num_items > 0: # only for printing

print("Now we have " + str(num_items) + " left")

print("All out!")

Explanation:

This allows Python to store the number of items in inventory after each purchase by subtracting how much is bought with the toBuy function by how much is left. This continues until num_items is no longer greater than zero. If what’s toBuy goes above the # of items left in inventory, then the “if toBuy > num_items” segment of the code comes into play by telling the user there’s not enough and re telling them how much is left and how much they’d like to buy. When the items in inventory is out, meaning the exact amount that’s left is purchased, then Python prints “All out!”

MissTica2 years ago
3 0

Answer:no

Explanation:

You might be interested in
Understanding the link between education and your desired career is an integral part of your career _______.
34kurt
I'm not 100% sure about my answer but based on articles I read online it makes the most sense to me.

Understanding the link between education and your desired career is an integral part of your career EXPLORATION.

The first step in career exploration is that you need to ask yourself this question "What can I do with this major?". If you have your answer, it is best to start exploring the connections that links your academic and professional interest.
7 0
2 years ago
Read 2 more answers
season is when the weather is not optimal and few tourists of vacation time a shoulder b high c average d low​
cricket20 [7]
Winter is such a season. Travel is lower to colder climate areas such as Canada, but higher to warmer climate areas like Columbia.
7 0
2 years ago
Read 2 more answers
Allie is working on the development of a web browser and wants to make sure that the browser correctly implements the Hypertext
creativ13 [48]

Answer:

The answer is "Option c"

Explanation:

The W3C is the framework for the creation of software and the online standards through which sites and webpages work, and to turn into an authoritative source of information, she will work towards getting a reliable and credible source of knowledge from the "World Wide Web Consortium", and the wrong option can be described as follows:

  • In option a, It is wrong because this organization prepares and publishes all the electronic technologies.
  • In option b, It is wrong because it is the laboratory of physics, which is not useful in web development.
  • In option d, This technology is used in TCP/IP protocol, that's why it is incorrect.
3 0
3 years ago
Why the computer is known as versatile and diligent device ? explain.<br>​
Scrat [10]

Answer:

Computer is called versatile and diligent device because it is used in almost all the fields for various purposes and it can perform the task repeatedly without loosing its speed and accuracy for long time.

5 0
1 year ago
The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable present
dolphi86 [110]

Answer:

B

Explanation:

Because you do not want to make your presentation be dark especially in a low lighted room.

(Certified MOS 2016 Powerpoint User)

8 0
3 years ago
Other questions:
  • You are running an application in Google App Engine that is serving production traffic. You want to deploy a risky but necessary
    9·1 answer
  • 2. Imagine you play a game of fetch with the dog. It takes the dog 60 seconds to run a total of 180 meters. What was the dog's a
    6·1 answer
  • Technician A says that the push rod connects to a pivoting component mounted at the top of the cylinder head called the camshaft
    14·2 answers
  • Ex: If the input is: Pat Silly Doe the output is: Doe, P.S.
    9·1 answer
  • Repl.it Assignment 4.1.2 (Guess the Number)<br> Please help me<br> I will give brainliest and a like
    10·1 answer
  • Concerning Structured Cabling, select the statement that is true, or select, "All statements are false."
    5·1 answer
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • What does this map key show
    12·1 answer
  • These brainly bots need to stop!!
    14·1 answer
  • For quantitative data (e.g. the number of milligrams of a drug) coding your data involves?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!