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
QUESTION 4 of 10: What term refers to the basic characteristics of a population segment, such as gender, age, and income?
marshall27 [118]
272727727272727226282829292
7 0
3 years ago
Read 2 more answers
Why students might want headsets for their computers?
VARVARA [1.3K]
It can be noisy and distracting to students to listen to audio speakers when there are multiple computers in the classroom. Headphones help the students
3 0
3 years ago
What is one of the limitations of marketing in social media?.
klemol [59]

One of the limitation of the social media marketing is the risk of negative comments that can hamper the marketing strategy and certainly hamper the sales.

<h3>What is marketing?</h3>

Marketing can be defined as the advertising of the services or products into the market for making the end user aware about the product. There are various marketing tricks that can help in increasing the sales of the products or services.

Learn more about marketing, here:

brainly.com/question/13414268

#SPJ1

3 0
2 years ago
WHAT IS MULTIMEDIA SUPPOSED TO MEAN ???
melisa1 [442]

Answer:

using more than one medium of expression or communication

3 0
2 years ago
Read 2 more answers
Why operating system is pivotal in teaching and learning
trasher [3.6K]

Answer:

Without it information flow is impossible

Explanation:

The word 'pivotal' also means crucial or vital, and so we need to consider what an operating system actually does.

Remember, merely having all the hardware of a computer would not allow you to run (install and use) programs. It is by means of an operating system that teaching programs can be installed, and it is also by means of an operating system learning can take place.

For example, a student can decode (learn) instructions/lessons from his teacher via a software program; and the software program needs an operating system to open (run) the program.

6 0
3 years ago
Other questions:
  • I need help please?!!!
    15·1 answer
  • You have an insurance policy with a $300 premium and a $500 deductible. How much should you expect to pay the insurance company
    15·1 answer
  • HELP PLEASE
    5·1 answer
  • How long does it take to be placed in a class on flvs?
    14·1 answer
  • Your employer is opening a new location, and the IT director has assigned you the task of calculating the subnet numbers for the
    14·1 answer
  • Which of the following statements is true? Computer disks are volatile storage devices Volatile storage is lost when a computer
    12·2 answers
  • What can be the maximum possible length of an identifier 3163 79 can be of any length​
    5·1 answer
  • Whats the most popular social networking in the philippines?
    10·1 answer
  • What Is the device used to produce hard copies from personal computer ​
    5·2 answers
  • Write a FOR loop that displays the following numbers exactly like this (you must use a loop):
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!