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]
3 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]3 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!”

MissTica3 years ago
3 0

Answer:no

Explanation:

You might be interested in
You're making great progress on your assignment. You've defined the purpose of your message, identified both the primary and sec
Varvara68 [4.7K]

The most effective way to convey your marketing message is to use the channel and media most used by your potential audience.

To discover the most effective channels and means to reach your audience, market research, online traffic study and other strategies to identify the habits and customs of your target market can be carried out.

A marketing message must be written in a way that engages consumers, creates value and desire for your product or service.

Relationship marketing is a strategy used by companies to create greater proximity and identification of the public with an organization through messages that generate greater value than just advertising, such as the use of blogs, tips, humor elements and other ways to engage the consumer to relate to the company in the language and perspective of the media where the message was conveyed.

The message effectiveness monitoring program is also essential for analyzing the effect of advertising on consumers, through publication traffic, number of visits, hours, number of clicks on the page, etc.

These message tracking programs are effective so that the marketing team can analyze, review and improve their communication through the data and information obtained.

Learn more here:

brainly.com/question/3100288

7 0
3 years ago
Your dad just purchased a new desktop with Windows 8 Professional. He is calling you, informing you that he is unable to remote
VladimirAG [237]
Maybe it's because he hasn't set up the new system once he does that then he should be able to function it but if he is still having trouble then he could call the company or ask for refund
4 0
4 years ago
You have installed a device that has eight interfaces and does not forward broadcast packets. What kind of device did you instal
Novay_Z [31]
A router, possibly. Thought I'm not for sure because I'm not in computers and technology

7 0
3 years ago
Read 2 more answers
If you do a Find and Replace for a term, where will Word begin looking for the term?
Norma-Jean [14]

Answer:

It automatically begins at the start of the document.

If you're using a search box, It will begin at the insertion point.

Explanation:

{}

6 0
3 years ago
Can't seem to get my code to work! Anyone care to help?
sasho [114]
Use a different calculator for your equation or put ,variable at end in variable u would put variable u put x y z or whatever variable u solve for
5 0
3 years ago
Other questions:
  • A standard science experiment is to drop a ball and see how high it bounces. Once the bounciness of the ball has been determined
    10·1 answer
  • ________ tv uses a digital signal, or series of 0s and 1s, and is much clearer and less prone to interference than analog tv. re
    9·1 answer
  • What portable computing devices, designed for user convenience, have a sensor called an accelerometer that senses vibrations and
    10·1 answer
  • You work as an IT Technician for uCertify Inc. David, a user, has recently purchased a laptop computer. He is now complaining th
    14·1 answer
  • Horizontal scaling of a client/server architecture means _____.
    12·1 answer
  • Describe a common error that presenters make during their presentation and how to remedy the error​
    12·2 answers
  • Sergio needs to tell his team about some negative feedback from a client. The team has been
    5·1 answer
  • Write ONE SQL statement for each of the following tasks. Note that you can only use conditions specified in the task description
    5·1 answer
  • What is meant by editing a document​
    5·2 answers
  • Question:
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!