Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Product Management Capstone | Conditional Statements
Introduction to Python
セクション 3.  8
single

single

bookChallenge: 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_type is exactly "Perishable":

    • If days_until_expiration is 3 or fewer, print: Big discount applied
    • Else (meaning more than 3 days), print: Small discount applied
  • If product_type is not "Perishable", print: No discount for non-perishable items.

Guidelines:

  • Use an outer if statement to check the product type.
  • Inside it, use an if/else to decide which discount message to print.
  • Print only one message.

解答

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

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

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

セクション 3.  8
single

single

AIに質問する

expand

AIに質問する

ChatGPT

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

some-alt