个人所得税计算:用户输入应发工资薪金所得、五险一金金额和个税免征额,输出应缴税款和实发工资, 结果保留小数点后两位。当输入数字小于0 或等于0 时,输出“error”。 实发工资 = 应发工资 - 五险一金 - 个人所得税 用python写出
时间: 2024-06-12 21:06:20 浏览: 8
salary = float(input("请输入应发工资薪金所得:"))
insurance = float(input("请输入五险一金金额:"))
exemption = float(input("请输入个税免征额:"))
if salary <= 0 or insurance <= 0 or exemption <= 0:
print("error")
else:
taxable_income = salary - insurance - exemption
if taxable_income <= 0:
tax = 0
elif taxable_income <= 36000:
tax = taxable_income * 0.03
elif taxable_income <= 144000:
tax = taxable_income * 0.1 - 2520
elif taxable_income <= 300000:
tax = taxable_income * 0.2 - 16920
elif taxable_income <= 420000:
tax = taxable_income * 0.25 - 31920
elif taxable_income <= 660000:
tax = taxable_income * 0.3 - 52920
elif taxable_income <= 960000:
tax = taxable_income * 0.35 - 85920
else:
tax = taxable_income * 0.45 - 181920
final_salary = salary - insurance - tax
print("应缴税款为:{:.2f},实发工资为:{:.2f}".format(tax, final_salary))
相关推荐
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)