个税计算器python
时间: 2023-10-17 13:36:39 浏览: 110
Python实现的个人所得税计算器示例
你好!关于个税计算器的Python编程,我可以给你一些指导。下面是一个简单的个税计算器示例代码,可以根据输入的年收入计算个人所得税:
```python
def calculate_tax(income):
tax = 0
if 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("个人所得税为: ", tax)
```
你可以根据需要进行修改和扩展,这是一个简单的示例,仅供参考。希望对你有帮助!如果有任何其他问题,请随时提问。
阅读全文