Shopping 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 discounted price in pounds (or in your own currency) (e.g. £90) and the discount rate that this price benefits from (e.g. 25%).
Your program will then calculate and display the original price (price before discount) of the item (e.g. £120).
Flowchart
Your program will consist of 3 key sections: Input > Process > Output
The flowchart of your program is as follows:
Python Code
Your task is to complete the following Python code:
Testing
You can now use your code to complete the following test plan:
Test # | Input Values | Expected Output | Actual Output |
#1 | Discounted Price: £90 Discount Rate: 25% |
Original Price: £120 | |
#2 | Discounted Price: £45 Discount Rate: 40% |
Original Price: £75 | |
#3 | Discounted Price: £210 Discount Rate: 30% |
Original Price: £300 |
Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area