Content · Programming · Python

Python Arithmetic Exercise: Calculate Discounts and Tax

A discount is normally applied to the original subtotal before calculating tax on the discounted amount, but tax rules can differ by location. Express each stage separately so it can be checked. Learn with a clear.

2 views Published Oct 17, 2026 Updated Oct 18, 2026 Admin

This guide explains Arithmetic Exercise: Calculate Discounts and Tax through a focused example and practical reasoning. No prior knowledge of this specific operation is required.

Understanding the Concept


A discount is normally applied to the original subtotal before calculating tax on the discounted amount, but tax rules can differ by location. Express each stage separately so it can be checked.

When You Would Use This


Estimate the bill for discounted equipment with an example tax rate.

Step-by-Step Example


original_price = 120.0
discount_rate = 0.15
tax_rate = 0.08
discounted_price = original_price * (1 - discount_rate)
tax_amount = discounted_price * tax_rate
final_total = discounted_price + tax_amount
print(f"Total: {final_total:.2f}")

How the Example Works


The discount reduces 120 to 102. Tax of 8.16 then produces a final total of 110.16. Each variable records a clear stage of the calculation.

Example Output


Total: 110.16

Try It Yourself


Try a 25% discount and a 5% tax; predict each intermediate value.

Common Beginner Mistakes


  • Subtracting 15 instead of 15% when the rate is 0.15.
  • Computing tax on the pre-discount price without checking the intended rule.
  • Using binary floats for legally binding financial calculations.

Key Takeaways


  • A discount is normally applied to the original subtotal before calculating tax on the discounted amount, but tax rules can differ by location.
  • The discount reduces 120 to 102.
  • Avoid this mistake: Subtracting 15 instead of 15% when the rate is 0.15.
Share this resourceSend this page to someone who may find it useful.