import math n = eval(input()) x = 0 if n < 0: print('error') else: if 0 <= n <= 5000: x = 0 elif 0 < n-5000 <= 3000: x = (n-5000)*0.03 elif 3000 < n-5000 <= 12000: x = (n-5000)*0.1-210 elif 12000 < n-5000 <= 25000: x = (n-5000)*0.2-1410 elif 25000 < n-5000 <= 35000: x = (n-5000)*0.25-2660 elif 35000 < n-5000 <= 55000: x = (n-5000)*0.3-4410 elif 55000 < n-5000 <= 80000: x = (n-5000)*0.35-7160 elif 80000 < n-5000: x = (n-5000)*0.45-15160 y=n-x print('应缴税款{:.2f}元,实发工资{:.2f}元。'.format(x,y))
时间: 2024-04-22 19:27:37 浏览: 138
这是一段Python代码,用于计算个人所得税和实发工资。代码中包含一个if-else语句和多个elif语句,用于根据输入的工资水平n计算个人所得税。计算结果存储在变量x中,而实发工资则通过减去个人所得税n-x得到,存储在变量y中。最后使用字符串格式化输出计算结果,其中{:.2f}代表输出格式为保留两位小数的浮点数。如果输入的工资水平n小于0,则输出'error'。
阅读全文
相关推荐
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)