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

single

bookChallenge: List Management

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

Are you ready to apply your new knowledge of lists and list methods in a practical setting?

This challenge will engage you in managing a grocery store's deli department items, requiring you to utilize nested lists, list methods, and conditional logic.

タスク

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

Work with a small deli department list by combining items, making one simple update, and sorting the final result.

  1. Initialize Lists:

    • Create a list meat with the values: "Ham", 3.99, 50, "Sliced";
    • Create a list cheese with the values: "Cheddar", 5.49, 100, "Sharp".
  2. Create Main List:

    • Combine meat and cheese into a single list called deli_dept.
  3. Restock Ham:

    • If the quantity of "Ham" is less than 100, update it to 100.
  4. Sort List:

    • Sort deli_dept alphabetically based on the first element of each sublist using the sort() method.

Output Requirements

  • Print the initial state of deli_dept with the message: "Initial Deli List: <deli_dept>".
  • After all operations, print the updated state of deli_dept with the message: "Updated Deli List: <deli_dept>".

解答

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

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

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

セクション 4.  4
single

single

AIに質問する

expand

AIに質問する

ChatGPT

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

some-alt