New Tax Calculator (Python): A beginner script that is extremely simple and does not do any troubleshooting, sending it up just so that you can add your own code to enrich it.
Click here to download: Newtax.zip
1 #-*-coding:cp936-*-
2 #This script is using the MIC only,powered by Rexchenhan
3 #proportion of pension insurance companies
4 ei_corate=0.323
5 #Proportion of individual pension insurance
6 ei_emprate=0.11
7 #ratio of Provident Fund companies
8 hf_corate=0.1
9 #Provident Fund Personal ratio
Tenhf_emprate=0.1
One #a tax levy point
AThreshold=3500
-
- emp_salary=Input ('Please enter your pre-tax salary:')
the #Start to calculate
- ei_emp=emp_salary*ei_emprate+Ten
- Ei_co=emp_salary*ei_corate
- hf_emp=emp_salary*hf_emprate
+ Hf_co=emp_salary*hf_corate
- Emp_sal_before_tax=emp_salary-(Hf_emp+ei_emp)
+ Sal_needtax=Emp_sal_before_tax-Threshold
A Tax=0.0
at Final_cash=0.0
- #Calculate Tax
- ifSal_needtax<=0:
- Tax=0.0
- elifSal_needtax< the:
- Tax=Sal_needtax*0.03
in elifSal_needtax<4500:
- Tax=Sal_needtax*0.1
to elifSal_needtax<9000:
+ Tax=Sal_needtax*0.2
- elifSal_needtax<35000:
the Tax=Sal_needtax*0.25
* elifSal_needtax<55000:
$ Tax=Sal_needtax*0.3
Panax Notoginseng elifSal_needtax<80000:
- Tax=Sal_needtax*0.35
the Else: Tax=Sal_needtax*0.45
+
A Final_cash=Emp_sal_before_tax-Tax
the #Start to print the result
+ STR1='Housing Provident Fund Payment: Personal commitment:%6.1F Company commitment:%6.1f'%(Hf_emp,hf_co)
- STR2='Endowment Insurance Payment: Individual undertaking:%6.1F Company undertakes:%6.1f'%(Ei_emp,ei_co)
$ STR3='after deduction of various types of insurance, tax payable part:%6.1f'%Emp_sal_before_tax
$ STR4='you need to pay tax:%6.1f'%Tax
- STR5='Your final income:%6.1f'%Final_cash
- Print'*'* -
the PrintSTR1
- PrintSTR2
Wuyi PrintSTR3
the PrintSTR4
- PrintSTR5
New Tax Calculator Python script