Секція 1. Розділ 29
single
Challenge: Sales and Shipments
Свайпніть щоб показати меню
In this challenge, you'll manage the daily stock levels of essential grocery store products over a week. By utilizing the range() function in conjunction with the len() function, you'll simulate sales impacts on inventory.
Завдання
Swipe to start coding
Update product stock levels based on sales and shipments using loops.
- Use a
forloop with index iteration to go through theproductslist.- For each product, subtract the number of units sold (
units_sold) from theproductsstock.
- For each product, subtract the number of units sold (
- Use a second
forloop (also with index iteration) to go throughproductsagain.- Add the corresponding value from
shipment_receivedto update the stock.
- Add the corresponding value from
At the end, print:
Final stock levels for all products: <products>
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 29
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат