Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Product Management Capstone | Conditional Statements
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to Python

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!

Task

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_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.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 8
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: 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!

Task

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_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.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 8
single

single

some-alt