已知程序框架如图所示,请按照此框架编写 Python 代码。并在红圈空缺处补充代码,使之完整,从而完成对应纳税所得额的计算。
时间: 2023-12-03 15:46:27 浏览: 33
```python
income = float(input("请输入您的税前收入:"))
# 计算五险一金
social_security_fund = income * 0.08 + income * 0.002 + income * 0.06 + income * 0.005 + 3 + 10
# 计算应纳税所得额
taxable_income = income - social_security_fund - 5000
if taxable_income <= 0:
tax = 0
elif 0 < taxable_income <= 3000:
tax = taxable_income * 0.03
elif 3000 < taxable_income <= 12000:
tax = taxable_income * 0.1 - 210
elif 12000 < taxable_income <= 25000:
tax = taxable_income * 0.2 - 1410
elif 25000 < taxable_income <= 35000:
tax = taxable_income * 0.25 - 2660
elif 35000 < taxable_income <= 55000:
tax = taxable_income * 0.3 - 4410
elif 55000 < taxable_income <= 80000:
tax = taxable_income * 0.35 - 7160
else:
tax = taxable_income * 0.45 - 15160
# 计算税后收入
income_after_tax = income - social_security_fund - tax
print("您的税前收入为:{:.2f}元".format(income))
print("您的五险一金为:{:.2f}元".format(social_security_fund))
print("您的应纳税额为:{:.2f}元".format(tax))
print("您的税后收入为:{:.2f}元".format(income_after_tax))
```
其中红圈空缺处应该补充的代码为:
```python
if taxable_income <= 0:
tax = 0
elif 0 < taxable_income <= 3000:
tax = taxable_income * 0.03
elif 3000 < taxable_income <= 12000:
tax = taxable_income * 0.1 - 210
elif 12000 < taxable_income <= 25000:
tax = taxable_income * 0.2 - 1410
elif 25000 < taxable_income <= 35000:
tax = taxable_income * 0.25 - 2660
elif 35000 < taxable_income <= 55000:
tax = taxable_income * 0.3 - 4410
elif 55000 < taxable_income <= 80000:
tax = taxable_income * 0.35 - 7160
else:
tax = taxable_income * 0.45 - 15160
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)