发布时间:2023-02-14 15:00
假设个人所得税税率表如下:
所得税计算公式如下:
应纳税额 = (工资薪金所得 - 五险一金 - 个税免征额) × 适用税率 - 速算扣除数
请编写一个个人所税计算器,用户输入应发工资薪金所得、五险一金金额和个税免征额,输出应缴税款和实发工资,结果保留小数点后两位。当输入数字小于0或等于0时,输出“error”。
其中:实发工资 = 应发工资 - 五险一金 - 应缴税款
WagesPayable , Insurance , ExemptionAmount = 0.00, 0.00, 0.00
try:
WagesPayable = eval(input("请输入应发工资:"))
Insurance = eval(input("请输入五险一金:"))
ExemptionAmount = eval(input("请输入个免税证额:"))
except NameError:
print("Error:NameError!")
print("输入有误")
else:
if WagesPayable <= 0 or Insurance <= 0 or ExemptionAmount <= 0:
print("error")
Taxes = 0.00
Num = WagesPayable - Insurance - ExemptionAmount
if Num > 0 and Num <= 3000:
Taxes = Num * 0.03
elif Num > 3000 and Num<= 12000:
Taxes = Num * 0.10 - 210
elif Num > 12000 and Num <= 25000:
Taxes = Num * 0.20 -1410
elif Num > 25000 and Num <= 35000:
Taxes = Num * 0.25 - 2660
elif Num > 35000 and Num <= 55000:
Taxes = Num * 0.30 - 4410
elif Num > 55000 and Num <= 80000:
Taxes = Num * 0.35 - 7160
elif Num > 80000:
Taxes = Num * 0.45 - 15160
Salary = WagesPayable - Insurance - Taxes;
print('应交税款 {:.2f} 元, 实发工资 {:.2f} 元'.format(Taxes,Salary))
个人能力有限,仅供参考,共同学习!