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

Did you like this challenge?

Click on a star to rate it!

Average rating 3.8 / 5. Vote count: 17

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: