A store has 100 boxes of tea every time there is a sale, the number of boxes sol
ID: 3834660 • Letter: A
Question
A store has 100 boxes of tea every time there is a sale, the number of boxes sold is deducted from the current stock until it becomes less than or equal to 20. The manager of the store must then place a new order. Write a code segment to repeatedly read the number of boxes sold daily and to update the current stock until it becomes less than or equal to 20. The message "places a new order" and the number of boxes purchase in order again l00 boxes in stock are then printed. Write a code segment to read the prices of one or more books and to compute and print their total price. prices are input one after another, and terminated with the sentinel value-99.00.Explanation / Answer
5)
current_stock = 100
while True:
x = int(input("Enter the no.of boxes you want: "))
current_stock = current_stock - x
if current_stock <= 20:
print("Place an order of " + str((100 - current_stock)) + ' boxes')
break
6)
list_of_values = []
while True:
x = float(input("Enter the book price: "))
if x == 99.00:
print("Total Price of the books is: ", sum(list_of_values))
break
else:
list_of_values.append(x)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.