TypeError Traceback (most recent call last)
Cell In[1], line 34
23 tax_rates = {
24 “0-3000”: 0.03,
25 “3000-12000”: 0.1,
(…)
30 “80000以上”: 0.45
31 }
33 # 确定个税适用税率
—> 34 tax_rate = next(rate for limit, rate in tax_rates.items() if tax_base <= limit)
36 # 计算个税
37 tax = tax_base * tax_rate
Cell In[1], line 34, in <genexpr>(.0)
23 tax_rates = {
24 “0-3000”: 0.03,
25 “3000-12000”: 0.1,
(…)
30 “80000以上”: 0.45
31 }
33 # 确定个税适用税率
—> 34 tax_rate = next(rate for limit, rate in tax_rates.items() if tax_base <= limit)
36 # 计算个税
37 tax = tax_base * tax_rate
TypeError: ‘<=’ not supported between instances of ‘float’ and ‘str’