2018年10月1号开始执行最新费率的个人所得税,这里用python实现个人所得税的计算:
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> def persontax(totalMoney):
resultMoney = 0
if totalMoney <= 5000:
return resultMoney
#金额区间
taxMoney= ((0,3000),(3000,12000),(12000,25000),(25000,35000),(35000,55000),(55000,80000),(80000,1000000000))
#费率元组
taxRate = (0.03,0.1,0.2,0.25,0.3,0.35,0.45)
#扣除元组
deductMoney = (0,210,1410,2660,4410,7160,15160)
#剩余金额
subMoney = totalMoney - 5000
#遍历金额区间
index = -1
for i in range(len(taxMoney)):
if taxMoney[i][0] <= subMoney <= taxMoney[i][1]:
index = i
break
if index >= 0 :
resultMoney = subMoney * taxRate[index] - deductMoney[index]
return resultMoney
>>> persontax(10000.00)
290.0
>>>