KeyError Traceback (most recent call last)
Cell In[1], line 31
29 # 计算总收入和扣税后的收入
30 total_income = social_security_base
—> 31 tax_amount = calculate_tax(total_income)
32 social_security_deduction = calculate_social_security(total_income)
34 # 最终扣税金额
Cell In[1], line 19, in calculate_tax(income)
17 for limit, rate in tax_rates.items():
18 if taxable_income > limit:
—> 19 tax += (limit - (tax_rates.get(limit-3000, 0) if limit > 3000 else 0)) * tax_rates[limit-3000]
20 else:
21 tax += taxable_income * rate
KeyError: -3000