salary = 30000 #工资 kouchu = 6000 + 2000 #五险一金和附加扣除(教育,医疗,养老等) i = 1 arr = [] brr = [] while i < 12: e = (salary - kouchu - 5000) * i if e <= 36000: k = e * 0.03 - sum(arr) arr.append(k) elif 36000 < e <= 144000: k = e *0.1 -sum(arr) - 2520 arr.append(k) elif 144000 < e <= 300000: k = e * 0.2 - sum(arr) - 16920 arr.append(k) elif 300000 < e <= 420000: k = e * 0.25 - sum(arr) - 31920 arr.append(k) elif 420000 < e <= 660000: k = e * 0.3 - sum(arr) - 52920 arr.append(k) elif 660000 < e <= 960000: k = e * 0.35 - sum(arr) - 52920 arr.append(k) elif 960000 < e: k = e * 0.45 - sum(arr) - 52920 arr.append(k) s = salary - kouchu - arr[i-1] brr.append(s) # print(‘%.1f‘ %arr[i-1],‘%.1f‘ %s) i += 1 print([round(i,2) for i in arr]) print([round(i,2) for i in brr]) 输出结果如下:
[510.0, 510.0, 1560.0, 1700.0, 1700.0, 1700.0, 1700.0, 1700.0, 2600.0, 3400.0, 3400.0]
[21490.0, 21490.0, 20440.0, 20300.0, 20300.0, 20300.0, 20300.0, 20300.0, 19400.0, 18600.0, 18600.0]
原文地址:https://www.cnblogs.com/tortoise512/p/10986153.html
时间: 2024-11-25 15:46:40