Solution 2: Python Essentials

Let’s look at the solution to the challenge related to Python essentials.

Function to calculate a receipt

You are a loyal customer, and a store is offering discounts to their loyal customers:

  • For a purchase between 0 & 50 CAD, you get a 10 % discount.
  • For a purchase between 51 & 100 CAD, you get a 20 % discount.
  • For a purchase of more than 100 CAD, you get a 40 % discount.
  • On Monday, if you spend more than 50 CAD, you get an additional 10 CAD OFF.

In this task, you need to write a function to calculate how much the customer’s purchase will actually cost after discounts and return that value.

Solution

Get hands-on with 1200+ tech skills courses.