以下代码会不会有极端错误情况: salary = float(input()) # salary 应发工资薪金所得 five_one_insurance_fund = float(input()) # five_one_insurance_fund 五险一金 exemption = float(input()) # exemption 个税免征额 if exemption <= 0 or salary <= 0 or five_one_insurance_fund <= 0: print("error") else: se = salary - five_one_insurance_fund - 5000 if se <= 3000: tax_rate = 0.03 dept = 0 elif se <= 12000: tax_rate = 0.1 dept = 210 elif se <= 25000: tax_rate = 0.2 dept = 1410 elif se <= 35000: tax_rate = 0.25 dept = 2660 elif se <= 55000: tax_rate = 0.3 dept = 4410 elif se <= 80000: tax_rate = 0.35 dept = 7160 else: tax_rate = 0.45 dept = 15160 tax = se * tax_rate - dept tax = max(0, tax) sf = salary - five_one_insurance_fund - tax print("应缴税款{:.2f}元,实发工资{:.2f}元。".format(tax, sf))
以下代码会不会有极端错误情况: salary = float(input()) # salary 应发工资薪金所得 five_one_insurance_fund = float(input()) # five_one_insurance_fund 五险一金 exemption = float(input()) # exemption 个税免征额 if exemption <= 0 or salary <= 0 or five_one_insurance_fund <= 0: print("error") else: se = salary - five_one_insurance_fund - 5000 if se <= 3000: tax_rate = 0.03 dept = 0 elif se <= 12000: tax_rate = 0.1 dept = 210 elif se <= 25000: tax_rate = 0.2 dept = 1410 elif se <= 35000: tax_rate = 0.25 dept = 2660 elif se <= 55000: tax_rate = 0.3 dept = 4410 elif se <= 80000: tax_rate = 0.35 dept = 7160 else: tax_rate = 0.45 dept = 15160 tax = se * tax_rate - dept tax = max(0, tax) sf = salary - five_one_insurance_fund - tax print("应缴税款{:.2f}元,实发工资{:.2f}元。".format(tax, sf))
以下代码会不会有极端错误情况:
salary = float(input()) # salary 应发工资薪金所得
five_one_insurance_fund = float(input()) # five_one_insurance_fund 五险一金
exemption = float(input()) # exemption 个税免征额
if exemption <= 0 or salary <= 0 or five_one_insurance_fund <= 0:
print("error")
else:
se = salary - five_one_insurance_fund - 5000
if se <= 3000:
tax_rate = 0.03
dept = 0
elif se <= 12000:
tax_rate = 0.1
dept = 210
elif se <= 25000:
tax_rate = 0.2
dept = 1410
elif se <= 35000:
tax_rate = 0.25
dept = 2660
elif se <= 55000:
tax_rate = 0.3
dept = 4410
elif se <= 80000:
tax_rate = 0.35
dept = 7160
else:
tax_rate = 0.45
dept = 15160
tax = se * tax_rate - dept
tax = max(0, tax)
sf = salary - five_one_insurance_fund - tax
print("应缴税款{:.2f}元,实发工资{:.2f}元。".format(tax, sf))
用户712188924
2023年09月20日
|
浏览 100
这段代码的目的是计算个人所得税和实发工资。在输入薪水、五险一金和个税免征额之后,代码会先检查是否存在极端错误情况(如免征额小于等于0,薪水小于等于0,五险一金小于等于0),如果存在则输出"error"。如果不存在极端错误情况,则根据薪水、五险一金和免征额计算个人所得税和实发工资,并输出结果。
我要提问
复制内容
分享给好友
AI编程问答网 免责声明:
以上内容除特别注明外均来源于网友提问,AI编程问答网回答,权益归原著者所有;