python个税计算器
时间: 2023-11-06 09:57:11 浏览: 190
python个税计算
def personal_income_tax_calculator(salary):
insurance = salary * 0.08 + salary * 0.02 + salary * 0.005 + salary * 0.06
tax_exemption = 5000
taxable_income = salary - insurance - tax_exemption
if taxable_income <= 0:
return "error"
if taxable_income <= 36000:
tax = taxable_income * 0.03 - 0
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
net_salary = salary - insurance - tax
return (round(tax, 2), round(net_salary, 2))
salary = float(input("请输入应发工资薪金所得扣除五险一金后的金额: "))
result = personal_income_tax_calculator(salary)
if result == "error":
print("输入错误,请重新输入大于0的金额。")
else:
tax = result
net_salary = result
print("应缴税款为: ", tax)
print("实发工资为: ", net_salary)
阅读全文