Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Pricing Adjustment Capstone | Other Data Types
Introduction to Python
セクション 4.  11
single

single

bookChallenge: Pricing Adjustment Capstone

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

You are managing a grocery store's system, and you need to maintain decision-making for the inventory, track prices, and perform checks to determine if actions like restocking or removing items from the inventory are needed based on their price or stock.

タスク

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

Manage a grocery inventory using a dictionary. You will do three simple things: update one price, add one new item, and restock one item. Print short status messages so you can see what changed.

  1. Create the Dictionary Define grocery_inventory with these items and details (category, price, stock):

    • "Milk": ("Dairy", 3.50, 8)
    • "Eggs": ("Dairy", 5.50, 30)
    • "Bread": ("Bakery", 2.99, 15)
  2. Discount Eggs

    • If the price of "Eggs" is greater than 5, print: Eggs are too expensive, reducing the price by $1. and reduce the price by 1.
  3. Add a New Item

    • Add "Tomatoes" with details: ("Produce", 1.20, 30)
    • Print: Inventory after adding Tomatoes: <grocery_inventory>
  4. Restock Milk

    • If the stock of "Milk" is less than 10, print: Milk needs to be restocked. Increasing stock by 20 units. and increase the stock by 20.
  5. Final Print

    • Print: Updated inventory: <grocery_inventory>

解答

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

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

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

セクション 4.  11
single

single

AIに質問する

expand

AIに質問する

ChatGPT

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

some-alt