This Python program reads an employee’s monthly salary and calculates the income tax based on a progressive tax table.
The tax rate is determined by the salary range according to the following table:
| From | To | Tax Rate |
|---|---|---|
| 0 | 483,000 | 0% |
| 483,001 | 965,000 | 10% |
| 965,001 | 1,448,000 | 15% |
| 1,448,001 | 1,930,000 | 20% |
| 1,930,001 | ∞ | 25% |
def calculate_tax(salary: int) -> float:
if salary <= 483000:
rate = 0
elif salary <= 965000:
rate = 0.10
elif salary <= 1448000:
rate = 0.15
elif salary <= 1930000:
rate = 0.20
else:
rate = 0.25
return salary * rate
# Read salary from user
salary = int(input("Enter monthly salary (in Rials): "))
tax = calculate_tax(salary)
print(f"Calculated tax: {tax:,.0f} Rials")
Calculated tax: 300,000 Rials
- The user enters their monthly salary
- The program checks which salary bracket the input falls into
- It applies the corresponding tax rate
- The tax amount is calculated and displayed