个人所得税计算:用户输入应发工资薪金所得、五险一金金额和个税免征额,输出应缴税款和实发工资, 结果保留小数点后两位。当输入数字小于0 或等于0 时,输出“error”。 实发工资 = 应发工资 - 五险一金 - 个人所得税
时间: 2024-06-12 15:06:02 浏览: 155
工资薪金所得个人所得税计算方法公式.docx
salary = float(input("请输入应发工资薪金所得:"))
if salary <= 0:
print("error")
else:
social_security = float(input("请输入五险一金金额:"))
if social_security <= 0:
print("error")
else:
tax_exempt = float(input("请输入个税免征额:"))
if tax_exempt < 0:
print("error")
else:
taxable_income = salary - social_security - tax_exempt
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
salary_after_tax = salary - social_security - tax
print("应缴税款为:{:.2f}".format(tax))
print("实发工资为:{:.2f}".format(salary_after_tax))
阅读全文