Challenge: Automating Stock Control
Swipe to start coding
You are restocking a grocery store before opening.
For each item in inventory, keep adding the restock amount until the stock reaches the target stock level.
Rules:
-
Print
Restocking startedbefore you begin. -
Use a
forloop to go through each item ininventory.- For each item, print:
Restocking <item name>
- For each item, print:
-
Use a
whileloop to restock that item until:current stockis at least thetarget stock level- Each time the loop runs, increase stock by the
restock amount
-
Update the
current stockinside the dictionary after restocking. -
Print
Restocking completedafter all items are processed.
Do not print any extra details about the stock numbers. Only print the required lines.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 1.89
Challenge: Automating Stock Control
Swipe to show menu
Swipe to start coding
You are restocking a grocery store before opening.
For each item in inventory, keep adding the restock amount until the stock reaches the target stock level.
Rules:
-
Print
Restocking startedbefore you begin. -
Use a
forloop to go through each item ininventory.- For each item, print:
Restocking <item name>
- For each item, print:
-
Use a
whileloop to restock that item until:current stockis at least thetarget stock level- Each time the loop runs, increase stock by the
restock amount
-
Update the
current stockinside the dictionary after restocking. -
Print
Restocking completedafter all items are processed.
Do not print any extra details about the stock numbers. Only print the required lines.
Solution
Thanks for your feedback!
single