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
for
loop with index iteration to go through theproducts
list.- For each product subtract the number of units sold (
units_sold
) from theproducts
stock.
- For each product subtract the number of units sold (
- Use a second
for
loop (also with index iteration) to go throughproducts
again.- Add the corresponding value from
shipment_received
to update the stock.
- Add the corresponding value from
Output Requirements
- After processing sales, print:
Stock after sales for <product_name>: <stock_level> units
- After processing shipments, print:
Stock after shipment for <product_name>: <stock_level> units
- At the end, print:
Final stock levels for all products: <products>
Ratkaisu
Kiitos palautteestasi!
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Tiivistä tämä luku
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 2.17
Challenge: Sales and Shipments
Pyyhkäise näyttääksesi valikon
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
for
loop with index iteration to go through theproducts
list.- For each product subtract the number of units sold (
units_sold
) from theproducts
stock.
- For each product subtract the number of units sold (
- Use a second
for
loop (also with index iteration) to go throughproducts
again.- Add the corresponding value from
shipment_received
to update the stock.
- Add the corresponding value from
Output Requirements
- After processing sales, print:
Stock after sales for <product_name>: <stock_level> units
- After processing shipments, print:
Stock after shipment for <product_name>: <stock_level> units
- At the end, print:
Final stock levels for all products: <products>
Ratkaisu
Kiitos palautteestasi!
Awesome!
Completion rate improved to 2.17single