我需要个税计算器的python代码
时间: 2023-06-03 07:03:07 浏览: 126
Python实现的个人所得税计算器示例
很高兴能够回答您的问题!以下是一个简单的个税计算器的 Python 代码,可以根据您的月薪和扣除项目计算您的个人所得税。
```python
salary = float(input("请输入您的月薪: "))
social_insurance = float(input("请输入您的社保缴费基数: "))
housing_fund = float(input("请输入您的公积金缴费基数: "))
deduction = 5000 # 国家规定的个税起征点
# 计算个人所得税
taxable_income = salary - social_insurance - housing_fund - deduction
if taxable_income <= 0:
tax = 0
elif taxable_income <= 36000:
tax = taxable_income * 0.03
elif taxable_income <= 144000:
tax = taxable_income * 0.10 - 2520
elif taxable_income <= 300000:
tax = taxable_income * 0.20 - 16920
elif taxable_income <= 420000:
tax = taxable_income * 0.25 - 31920
elif taxable_income <= 660000:
tax = taxable_income * 0.30 - 52920
elif taxable_income <= 960000:
tax = taxable_income * 0.35 - 85920
else:
tax = taxable_income * 0.45 - 181920
print("个人所得税为: %.2f" % tax)
```
希望以上代码能够帮到您!
阅读全文