In this post, we are going to write python program to calculate GST and income tax using different formulas . In the first program ,we will calculate GST tax using GST formula and then calculate income tax .
Lets see how to calculate GST.
To calculate the GST% first, we need to calculate the net GST amount by subtracting the Original price from Net price in which the GST is included. After Calculating the net GST amount, we will apply the GST% formula which is given below:-
GST% formula = ((GST Amount * 100)/Original price)
Net price = Original price + GST amount
GST amount = Net price – Original price
GST% = ((GST amount * 100)/Original price)
python program to calculate GST
# Reading inputs from user
p = float(input("Enter Original amount : "))
np = float(input("Enter net price : "))
# Calculating GST amount
GST_amount = np - p
# Calculating GST percentage
GST_percent = ((GST_amount * 100) / p)
print("GST = ",end='')
print(round(GST_percent),end='')
print("%")
Output
Enter Original amount : 1200 Enter net price : 1250 GST = 4%
Python program to calculate Income Tax
Here, we are going to write python program to calculate income tax . Lets see how to calculate income tax on income.
We will use following condition to calculate income tax on annual income. They are as follows,
If annual income is less than or equivalent to Rs. 2,50,000, you will pay no tax.
If annual income is less than or equal to Rs. 5,00,000, your tax will be 5% of your total income over Rs. 2,50,000.
If annual income is less than or equal to Rs. 7,50,000, your tax rate will be 10% of your total income beyond Rs. 5,00,000, with an additional cost of Rs. 12,500.
If annual income is less than or equivalent to Rs. 10,00,000, your tax rate will be 15% of your total income over Rs. 7,50,000, with an additional fee of Rs. 37,500.
If annual income is less than or equal to Rs. 12,50,000, your tax rate will be 20% of your total income beyond Rs. 10,00,000, with an additional fee of Rs. 75,000.
If annual income is less than or equal to Rs. 15,00,000, your tax rate will be 25% of your total income beyond Rs. 12,50,000, with an additional cost of Rs. 1,25,000.
If annual income exceeds Rs. 15,00,000, you will be taxed at 30% of the excess, with an additional fee of Rs. 1,87,500.
Python code to calculate income tax using if-else loop
# Give the income as user input using int(input()) and store it in a variable.
annualincome = int(input('Enter your annual income = '))
# We will use if and else statements here to complete our income tax calculating conditions,
# which are as follows,
# If your income is less than or equivalent to Rs. 2,50,000,the taxAmount=0.
if annualincome <= 250000:
taxAmount = 0
# If your income is less than or equal to Rs. 5,00,000,
# the taxAmount will be 5% of your total income over Rs. 2,50,000.
elif annualincome <= 500000:
taxAmount = (annualincome - 250000) * 0.05
# If your income is less than or equal to Rs. 7,50,000,
# your taxAmount rate will be 10% of your total income
# beyond Rs. 5,00,000, with an additional cost of Rs. 12,500.
elif annualincome <= 750000:
taxAmount = (annualincome - 500000) * 0.10 + 12500
# If your income is less than or equivalent to Rs. 10,00,000,
# your taxAmount rate will be 15% of your total income over Rs. 7,50,000,
# with an additional fee of Rs. 37,500.
elif annualincome <= 1000000:
taxAmount = (annualincome - 750000) * 0.15 + 37500
# If your income is less than or equal to Rs. 12,50,000,
# your taxAmount rate will be 20% of your total income beyond Rs. 10,00,000,
# with an additional fee of Rs. 75,000.
elif annualincome <= 1250000:
taxAmount = (annualincome - 1000000) * 0.20 + 75000
# If your income is less than or equal to Rs. 15,00,000,
# your taxAmount rate will be 25% of your total income beyond Rs. 12,50,000,
# with an additional cost of Rs. 1,25,000.
elif annualincome <= 1500000:
taxAmount = (annualincome - 1250000) * 0.25 + 125000
# If your income exceeds Rs. 15,00,000,
# you will be taxed at 30% of the excess, with an additional fee of Rs. 1,87,500.
else:
taxAmount = (annualincome - 1500000) * 0.30 + 187500
# Print the Tax.
print('The calculated income tax on ', annualincome, '=', taxAmount)
Output
Enter your annual income = 4560000 The calculated income tax on 4560000 = 1105500.0 Enter your annual income = 2500000 The calculated income tax on 2500000 = 487500.0