Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Discount Calculator | Python Ternary Operator
Conditional Statements in Python
course content

Course Content

Conditional Statements in Python

Conditional Statements in Python

1. Python if Statement
2. Python if-else Statement
3. Python if-elif-else Statement
4. Python Ternary Operator

bookChallenge: Discount Calculator

To tackle this task, you should have a good understanding of functions. It's recommended to review the Functions topic beforehand.

Task

Now, let's put the discount calculator to work. This function will determine the final payment amount based on the total receipt sum. The function is called total_discount and takes the total receipt amount as basket_value. If the basket_value is equal to or greater than $50, a 10% discount is applied; if it's less than $50, a 3% discount is applied.

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 4. Chapter 2
toggle bottom row

bookChallenge: Discount Calculator

To tackle this task, you should have a good understanding of functions. It's recommended to review the Functions topic beforehand.

Task

Now, let's put the discount calculator to work. This function will determine the final payment amount based on the total receipt sum. The function is called total_discount and takes the total receipt amount as basket_value. If the basket_value is equal to or greater than $50, a 10% discount is applied; if it's less than $50, a 3% discount is applied.

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 4. Chapter 2
toggle bottom row

bookChallenge: Discount Calculator

To tackle this task, you should have a good understanding of functions. It's recommended to review the Functions topic beforehand.

Task

Now, let's put the discount calculator to work. This function will determine the final payment amount based on the total receipt sum. The function is called total_discount and takes the total receipt amount as basket_value. If the basket_value is equal to or greater than $50, a 10% discount is applied; if it's less than $50, a 3% discount is applied.

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!

To tackle this task, you should have a good understanding of functions. It's recommended to review the Functions topic beforehand.

Task

Now, let's put the discount calculator to work. This function will determine the final payment amount based on the total receipt sum. The function is called total_discount and takes the total receipt amount as basket_value. If the basket_value is equal to or greater than $50, a 10% discount is applied; if it's less than $50, a 3% discount is applied.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 4. Chapter 2
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt