salary = 20000 #工资
kouchu = 3000 #五险一金
fujia = 2000 #附加扣除(教育,医疗,养老等)
i = 1
arr = []
brr = []
while i <= 12:
e = (salary - kouchu -fujia - 5000) * i
if 0 < e <= 36000:
k = e * 0.03
elif 36000 < e <= 144000:
k = e * 0.1 - 2520
elif 144000 < e <= 300000:
k = e * 0.2 - 16920
elif 300000 < e <= 420000:
k = e * 0.25 - 31920
elif 420000 < e <= 660000:
k = e * 0.3 - 52920
elif 660000 < e <= 960000:
k = e * 0.35 - 85920
elif e > 960000:
k = e * 0.45 - 181920
else:
k = 0
tax = k - sum(arr)
arr.append(tax)
s = salary - kouchu - tax
brr.append(s)
i += 1
print([round(i,2) for i in arr])
print([round(i,2) for i in brr])
输出结果:
[300.0, 300.0, 300.0, 580.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0]
[16700.0, 16700.0, 16700.0, 16420.0, 16000.0, 16000.0, 16000.0, 16000.0, 16000.0, 16000.0, 16000.0, 16000.0]