Editor

Shop Bill With a Discount

Programs with input · Intermediate · about 9 min

A shop gives a discount on big bills. Read how many items were bought, then the price of each item in rupees, one per line (prices may have decimals). The discount depends on the total:

  • 10% off when the total is 1000 or more
  • 5% off when the total is 500 or more
  • no discount below 500

Print the total, the discount and the amount to pay, each with 2 decimal places, as Total: 1250.00, Discount: 125.00 and To pay: 1125.00. If no items were bought, all three are 0.00.

The prompts inside input() are not checked, only what you print.

Example

You type:

3
400
500
350

The program prints:

Total: 1250.00
Discount: 125.00
To pay: 1125.00
count = int(input("How many items? "))
# Read each price, then print the total, the discount and the amount to pay
The solution opens after your first Check.