Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Sales and Shipments | Loops
/
Introduction to Python
セクション 5.  7
single

single

bookChallenge: 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.

タスク

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

Update the stock levels using one loop.

  • Use a for loop with index iteration (range) to go through products.

  • For each product, subtract the sold amount from units_sold using the same index:

    • products[i][1] = products[i][1] - units_sold[i]

At the end, print exactly: Final stock levels: <products>

Expected final products: [['Apples', 7], ['Bananas', 3]]

解答

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

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

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

セクション 5.  7
single

single

AIに質問する

expand

AIに質問する

ChatGPT

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

some-alt