个人所得税计算器python
时间: 2023-10-19 17:33:53 浏览: 171
以下是一个简单的个人所得税计算器 Python 代码:
```python
def calculate_tax(income):
if income <= 5000:
tax = 0
elif 5000 < income <= 8000:
tax = (income - 5000) * 0.03
elif 8000 < income <= 17000:
tax = (income - 8000) * 0.1 + 90
elif 17000 < income <= 30000:
tax = (income - 17000) * 0.2 + 990
elif 30000 < income <= 40000:
tax = (income - 30000) * 0.25 + 3590
elif 40000 < income <= 60000:
tax = (income - 40000) * 0.3 + 6090
elif 60000 < income <= 85000:
tax = (income - 60000) * 0.35 + 12090
else:
tax = (income - 85000) * 0.45 + 20840
return tax
income = float(input("请输入您的税前收入:"))
tax = calculate_tax(income)
print("您的应纳税额为:{:.2f}元".format(tax))
```
使用方法:
1. 运行代码后,会提示输入税前收入;
2. 输入税前收入,按回车键确认;
3. 程序会计算个人所得税并输出结果。
注意:此代码仅供参考,税率和起征点可能会有所变化,请以国家政策为准。
阅读全文