セクション 3. 章 8
single
Challenge: Product Management Capstone
メニューを表示するにはスワイプしてください
Congratulations on reaching this point in the course! In this capstone challenge, you will manage perishable products at a grocery store, determining discounts based on product expiration and stock levels. Your goal is to minimize waste while effectively maximizing sales through strategic discounting.
Let's see how well you can translate business rules into Python code!
タスク
スワイプしてコーディングを開始
Write a program that prints a discount message for a grocery product based on its type and how soon it expires.
Rules:
-
If
product_typeis exactly"Perishable":- If
days_until_expirationis 3 or fewer, print:Big discount applied - Else (meaning more than 3 days), print:
Small discount applied
- If
-
If
product_typeis not"Perishable", print:No discount for non-perishable items.
Guidelines:
- Use an outer
ifstatement to check the product type. - Inside it, use an
if/elseto decide which discount message to print. - Print only one message.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 3. 章 8
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください