Flowchart to Python Code – Discount Price Calculator

discountShopping during the sales can sometimes be very confusing. With discounted prices at 10%, 20%, 50% or even 70%!

For this challenge you are going to write a Python script that prompts the user to enter a price in pounds (or in your own currency) (e.g. £90) and a discount rate to apply (e.g. 20%).

Your program will then calculate and display the discounted price.

We will use the following algorithm for our program:
flowchart-discount-price-calculator

Python Code


This algorithm is a good example of:
sequencing-label

Testing


Once your code is done, complete the following tests to check that your code is working as expected:

Test # Input Values Expected Output Actual Output
#1 Price: £100
Discount Rate: 25%
Discount: £25
Discounted Price: £75
#2 Price: £160
Discount Rate: 40%
Discount: £64
Discounted Price: £96
#3 Price: £180
Discount Rate: 10%
Discount: £18
Discounted Price: £162
Share Button
Tagged with: