Part of the series

Several example codes

~1 min read • Updated Oct 12, 2025

Program Overview

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:

Tax Table:

FromToTax Rate
0483,0000%
483,001965,00010%
965,0011,448,00015%
1,448,0011,930,00020%
1,930,00125%

Python Code:


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")

Sample Output (input: 1,500,000 Rials):


Calculated tax: 300,000 Rials

Step-by-Step Explanation:

- 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


Written & researched by Dr. Shahin Siami