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!
Swipe to start coding
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.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 1.89
Challenge: Product Management Capstone
Swipe to show menu
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!
Swipe to start coding
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.
Solution
Thanks for your feedback!
single