PF contribution by the employer is assumed to be 12% of the gross income, however can be changed in the function's parameters
def old_tax_regime(gross_income,employer_pf,employer_nps):
income = (gross_income-employer_pf)/1e5 #income in lakhs
#Standard deduction : 50k
income += -0.5
#80C deductions : 1.5lac
income += -1.5
#80CCD(1b) : NPS self-contribution : 50k
income += -0.5
#80CCD(2) : Employer NPS contribution : max 10% of gross_income
income += -employer_nps/1e5
tax = 0
if income>10 :
tax = 0.05*2.5 + 0.2*5 + 0.3*(income-10)
elif income>5:
tax = 0.05*2.5 + 0.2*(income-5)
elif income>2.5:
tax = 0.05*(income-2.5)
return tax
def new_tax_regime(gross_income,employer_pf,employer_nps):
income = (gross_income-employer_pf)/1e5 #income in lakhs
#80CCD(2) : Employer NPS contribution : max 10% of gross_income
income += -employer_nps/1e5
tax = 0
if income>15 :
tax = (0.05+0.1+0.15+0.2+0.25)*2.5 + 0.3*(income-15)
elif income>12.5:
tax = (0.05+0.1+0.15+0.2)*2.5 + 0.25*(income-12.5)
elif income>10:
tax = (0.05+0.1+0.15)*2.5 + 0.2*(income-10)
elif income>7.5:
tax = (0.05+0.1)*2.5 + 0.15*(income-7.5)
elif income>5:
tax = 0.05*2.5 + 0.1*(income-5)
elif income>2.5:
tax = 0.05*(income-2.5)
return tax
incomes = [9e5,10e5,11e5,12e5,13e5,14e5,15e5,16e5,17e5,18e5,19e5]
for i in incomes:
old = int(1e5*(old_tax_regime(i,0.12*i,0)))
new = int(1e5*(new_tax_regime(i,0.12*i,0)))
print("%d lakhs gross -- old: %d -- new: %d"%(i/1e5,old,new))