Calculation of individual income tax for year-end bonus
def nzjgs(n): """ :type n: float Total year-end bonus :rtype: float Year end bonus tax payment """ tmp = n/12 if tmp <= 3000: return n * 0.03 if 3000 < tmp <= 12000: return n * 0.1 - 210 if 12000 < tmp <= 25000: return n * 0.2 - 1410 if 25000 < tmp <= 35000: return n * 0.25 - 2660 if 35000 < tmp <= 55000: return n * 0.3 - 4410 if 55000 < tmp <= 80000: return n * 0.35 - 7160 return n * 0.45 - 15160
If my year-end bonus is 40000 (only if), then the 3790.0 obtained after calling the function calculation is the tax payment.
print(nzjgs(40000)) 3790.0
Monthly income tax calculation
def yxgs(n, s, shebao, qitakouchu, zhuanxiangfujiakouchu): """ :type n: float month :type s: float a monthly salary :type shebao: float Monthly social security payment :type qitakouchu: float Other monthly deductions :type zhuanxiangfujiakouchu: float Monthly special additional deduction :rtype: tuple (List of monthly taxes paid by the end of this month, tax paid in this month, Total tax payment as of this month) """ koushui = [] for i in range(1, n+1): total_s = s * i total_shebao = shebao * i total_zhuanxiangkouchu = qitakouchu * i total_5000 = 5000 * i total_zhuanxiangfujiakouchu = zhuanxiangfujiakouchu * i total_suodee = total_s - total_shebao - total_zhuanxiangkouchu - total_5000 - total_zhuanxiangfujiakouchu if total_suodee <= 36000: koushui.append(total_suodee * 0.03 - sum(koushui)) if 36000 < total_suodee <= 144000: koushui.append(total_suodee * 0.1 - 2520 - sum(koushui)) if 144000<total_suodee<=300000: koushui.append(total_suodee * 0.2 - 16920 - sum(koushui)) if 300000<total_suodee<=420000: koushui.append(total_suodee * 0.25 - 31920 - sum(koushui)) if 420000<total_suodee<=660000: koushui.append(total_suodee * 0.3 - 52920 - sum(koushui)) if 660000<total_suodee<=960000: koushui.append(total_suodee * 0.35 - 85920 - sum(koushui)) if 960000<total_suodee: koushui.append(total_suodee * 0.45 - 181920 - sum(koushui)) return koushui, koushui[-1], sum(koushui)
If my monthly salary is 20000, I pay social security 2025 every month, special additional deduction is 0, and other deduction expenses are 300, then my tax payment in the 12th month is 2077.5:
print(yxgs(12, 20000, 2025, 300, 0)) ([380.25, 380.25, 522.0, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 2077.5], 2077.5, 13500.0)
the sum
If the above two parts are my income for one year, after calculating the above two parts respectively, the total tax paid this year is 17290.0. In the 12th month, because I got the salary and year-end bonus at the same time, the tax paid is 5867.5.
Calculation of individual income tax of new year-end bonus in 2022
If I still have a monthly salary of 20000 and other deducted expenses remain unchanged, then the first 11 months are still the same as before, but from 2022, the salary and year-end bonus are combined to calculate the individual income tax, so the tax payment in the 12th month must include the usual monthly salary and year-end bonus. This function must apply the previous function.
def xbnzjgs(nzj, n, shebao, qitakouchu, zhuanxiangfujiakouchu): """ :type nzj: float annual bonus :type n: float a monthly salary :type shebao: float Monthly social security payment :type qitakouchu: float Other monthly deductions :type zhuanxiangfujiakouchu: float Monthly special additional deduction :rtype: Tax paid in the 12th month """ p = yxgs(11, n, shebao, qitakouchu, zhuanxiangfujiakouchu) total_suodee = nzj + n * 12 - (shebao + qitakouchu + zhuanxiangfujiakouchu + 5000) * 12 if total_suodee <= 36000: return total_suodee * 0.03 - p[2] if 36000 < total_suodee <= 144000: return total_suodee * 0.1 - 2520 - p[2] if 144000<total_suodee<=300000: return total_suodee * 0.2 - 16920 - p[2] if 300000<total_suodee<=420000: return total_suodee * 0.25 - 31920 - p[2] if 420000<total_suodee<=660000: return total_suodee * 0.3 - 52920 - p[2] if 660000<total_suodee<=960000: return total_suodee * 0.35 - 85920 - p[2] if 960000<total_suodee: return total_suodee * 0.45 - 181920 - p[2]
For example, if my usual monthly salary is 20000, if the year-end bonus is 40000 and the others remain unchanged, the tax paid in the 12th month is 10077.5:
print(xbnzjgs(40000, 20000, 2025, 300, 0)) 10077.5
It can be seen that the total tax paid in the 12th month is 4210 more than that in the previous month. This tax deduction is really too cruel. What else can I say? Maybe I think the middle-class leeks in society are growing taller and have to be cut off.
"Python experience sharing"
It's good to learn Python well, whether in employment or sideline, but to learn python, you still need to have a learning plan. Finally, I'll share a full set of Python learning materials for free to give some help to those who want to learn Python!
1, Python learning routes in all directions
All directions of Python is to sort out the commonly used technical points of Python and form a summary of knowledge points in various fields. Its purpose is that you can find corresponding learning resources according to the above knowledge points to ensure that you learn more comprehensively.
2, Learning software
If a worker wants to do well, he must sharpen his tools first. The commonly used development software for learning Python is here, which saves you a lot of time.
3, Getting started video
When we watch videos, we can't just move our eyes and brain without hands. The more scientific learning method is to use them after understanding. At this time, the hand training project is very suitable.
4, Actual combat cases
Optical theory is useless. We should learn to knock together and practice, so as to apply what we have learned to practice. At this time, we can make some practical cases to learn.
5, Interview materials
We must learn Python in order to find a high paying job. The following interview questions are the latest interview materials from front-line Internet manufacturers such as Alibaba, Tencent and byte, and Alibaba boss has given authoritative answers. After brushing this set of interview materials, I believe everyone can find a satisfactory job.
This complete set of Python learning materials has been uploaded to CSDN
If you need it, you can scan the official authentication QR code of CSDN below on wechat and get it for free [guarantee 100% free].