UnboundLocalError Traceback (most recent call last)
Cell In[1], line 43
41 # 假设月收入为12200元
42 monthly_income = 12200
—> 43 total_deduction_amount = total_deduction(monthly_income)
44 total_deduction_amount
Cell In[1], line 39, in total_deduction(income)
38 def total_deduction(income):
—> 39 return calculate_tax(income) + calculate_social_insurance(income)
Cell In[1], line 14, in calculate_tax(income)
12 for limit, rate in tax_rates.items():
13 if income > limit:
—> 14 tax += (limit - tax_free_income) * rate
15 tax_free_income = limit
16 else:
UnboundLocalError: local variable ‘tax_free_income’ referenced before assignment