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
A multi-national retail company has multiple business divisions with each division having its own AWS account. The engineering t
velikii [3]

Answer:

C. X-ray

Explanation:

AWS X-ray is a form of service that assists developers in carrying out analysis and debugging functions, and at the same time helps in the allotted applications, including those built using a microservices architecture.

In other words, an X-ray, in this case, will assist the developers in carrying out the following:

1. Establish a service map

2. Single out errors and bugs

3. Construct analysis and visualization apps

4. Enhancing the experience for end-users of the application under x-ray.

4 0
3 years ago
what is created when the movement of light is blocked by an object and cannot pass through the other side?
larisa86 [58]
A shadow is created.
7 0
3 years ago
Read 2 more answers
Integral 3t+ 1 / (t + 1)^2​
Verizon [17]

Answer:

3ln|t+1|+\frac{2}{t+1} +C

Explanation:

We'll be using u-substitution for this problem.

Let

u=t+1\\du=dt

Substitute

\int\limits {\frac{3u-2}{u^2}} \, du

Split the fraction

\int\limits {\frac{3u}{u^2} } \, du -\int\limits {\frac{2}{u^2} } \, du

Move the constants out

3\int\limits {\frac{u}{u^2}du -2\int\limits {u^{-2}} \, du

Simplify

3\int\limits {\frac{1}{u}du -2\int\limits {u^{-2}} \, du

Integrate

3ln|u|+\frac{2}{u} +C

Substitute

3ln|t+1|+\frac{2}{t+1} +C

5 0
3 years ago
Choose the correct term to complete the sentence.
Alex

Answer:

the answer to your question is obviously "rational"

3 0
3 years ago
Question 1 of 5
saveliy_v [14]
B) each person gets to contribute in their own unique way
8 0
3 years ago
Read 2 more answers
Other questions:
  • You would like to know how many cells contain data. Which function should you use? COUNT MIN SUM ABS
    14·1 answer
  • What role do you think mobile devices have played in shaping the world?
    13·1 answer
  • What is used for World Wide Web?
    7·1 answer
  • What is f(-3) for the function f(a)=-2a2-5a+4?​
    10·1 answer
  • If you were looking for a record in a very large database and you knew the ID number, which of the following would be the most d
    6·1 answer
  • The ash and dust from a volcanic eruption can cause a ______ change in the environment.
    8·1 answer
  • Command create database in oracle database ::((
    8·1 answer
  • g 'write a function that takes as input a list and outs a new list containing all elements from the input
    5·1 answer
  • Does digital media play a big role in your life?
    13·1 answer
  • What best describes the ability to increase the access to server resources and provide fail-safe services by linking two or more
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!