python实现个人所得税
时间: 2023-10-30 09:22:46 浏览: 80
好的,我可以为您提供一个简单的 Python 个人所得税计算器示例。以下是代码:
```python
def calculate_tax(income):
if income <= 0:
return 0
elif income <= 36000:
tax = income * 0.03
elif income <= 144000:
tax = income * 0.1 - 2520
elif income <= 300000:
tax = income * 0.2 - 16920
elif income <= 420000:
tax = income * 0.25 - 31920
elif income <= 660000:
tax = income * 0.3 - 52920
elif income <= 960000:
tax = income * 0.35 - 85920
else:
tax = income * 0.45 - 181920
return tax
income = float(input("请输入您的年收入:"))
tax = calculate_tax(income)
print("您的个人所得税为:{:.2f} 元".format(tax))
```
使用时,只需要输入您的年收入即可得到相应的个人所得税。该计算器遵循国家税务总局发布的《个人所得税法》规定,根据您的年收入来计算应缴纳的税额。
阅读全文