#532 · Python Basics · Beginner · 30 XP · about 5 min
A stationery shop works out each bill in three steps:
price * quantity.tax_percent percent is then added to the subtotal, after any discount.Write total_price(price, quantity, tax_percent) that returns what the customer pays, rounded to 2 decimal places with round(value, 2).
total_price(2.5, 4, 8) # returns 10.8 total_price(2.5, 10, 8) # returns 24.3 total_price(19.99, 1, 0) # returns 19.99
In the second example the subtotal is 25.0, the discount brings it to 22.5, and 8 percent tax on top makes 24.3.
quantity and tax_percent are whole numbers, 0 or more.
First solves only, ranked by stars and then time.