Income Tax Calculator using Python

In this article, We’ll create a Python program that determines the income tax owed on a specific quantity of money. Please be informed that the income tax slabs are changed every year. Since income taxes vary from nation to nation, we have created a program that solely supports the Indian format and uses India as the country for tax calculation.

Tax slabs for AY 2022-23

AMOUNT                             INCOME TAX RATE
Up to â‚¹2,50,000                     0%
â‚¹2,50,001 – â‚¹5,00,000           5% above â‚¹2,50,000
â‚¹5,00,001 – â‚¹7,50,000           10% above â‚¹5,00,000 + â‚¹12,500
â‚¹7,50,001 – â‚¹10,00,000         15% above â‚¹7,50,000 + â‚¹37,500
â‚¹10,00,001 – â‚¹12,50,000       20% above â‚¹10,00,000 + â‚¹75,000
â‚¹12,50,001 – â‚¹15,00,000       25% above â‚¹12,50,000 + â‚¹1,25,000
Above â‚¹15,00,001                  30% above â‚¹15,00,000 + â‚¹1,87,500

Python Program to Calculate Income Tax

In this program, we will take annual income from the user as input after that we will pass that data to compare the Tax slab with different if-else conditions. After comparing we will calculate the tax and return it to that function to print the calculated Tax on that Income.

Python3

 `def` `calculate(amount, percent): ``    ``return` `(amount ``*` `percent) ``/` `100`` ` `def` `calculate_income_tax(total_income:  ``                         ``float``) ``-``> ``float``: `` ` `    ``if` `total_income <``=` `250000``: ``        ``return` `0``    ``elif` `total_income <``=` `500000``: ``        ``return` `calculate(total_income ``-` `                         ``250000``, ``5``) ``    ``elif` `total_income <``=` `750000``: ``        ``return` `calculate(total_income ``-` `                         ``500000``, ``10``) ``+` `12500``    ``elif` `total_income <``=` `1000000``: ``        ``return` `calculate(total_income ``-` `                         ``750000``, ``15``) ``+` `37500``    ``elif` `total_income <``=` `1250000``: ``        ``return` `calculate(total_income ``-` `                         ``1000000``, ``20``) ``+` `75000``    ``elif` `total_income <``=` `1500000``: ``        ``return` `calculate(total_income ``-` `                         ``1250000``, ``25``) ``+` `125000``    ``else``: ``        ``return` `calculate(total_income ``-` `                         ``1500000``, ``30``) ``+` `187500`` ` ` ` `if` `__name__ ``=``=` `'__main__'``: ``    ``total_income ``=` `float``(``input``("What's your \ ``                    ``annual income?\n>>> ")) ``    ``tax ``=` `calculate_income_tax(total_income) ``    ``print``(f"Total tax applicable at \ ``                    ``â‚¹{total_income} ``is` `â‚¹{tax}") `

Input 1: When your income is â‚¹1,00,000 which is less than â‚¹2,50,000 then the tax should be â‚¹0

Output:

Input 2: When the income is â‚¹3,00,000 which is more than â‚¹2,50,000 then the tax should be â‚¹2,500

Output:

Input 3: When the income is â‚¹7,00,000 which is more than â‚¹5,00,000 then the tax should be â‚¹32,500

Output:

Input 4: When your income is â‚¹1,00,00,000 which is more than â‚¹15,00,000 then the tax should be â‚¹27,37,500

Output:

Previous
Next