Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Automating Stock Control | Loops
Introduction to Python
セクション 5.  9
single

single

bookChallenge: Automating Stock Control

メニューを表示するにはスワイプしてください

タスク

スワイプしてコーディングを開始

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:

  1. Print Restocking started before you begin.

  2. Use a for loop to go through each item in inventory.

    • For each item, print: Restocking <item name>
  3. Use a while loop to restock that item until:

    • current stock is at least the target stock level
    • Each time the loop runs, increase stock by the restock amount
  4. Update the current stock inside the dictionary after restocking.

  5. Print Restocking completed after all items are processed.

Do not print any extra details about the stock numbers. Only print the required lines.

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 5.  9
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt