TypeError Traceback (most recent call last)
Cell In[1], line 24
18 insurance_costs[insurance] = {
19 ‘单位’: social_security_base * rates[‘单位’],
20 ‘个人’: social_security_base * rates[‘个人’]
21 }
23 # 计算总费用
—> 24 total_costs = sum(insurance_costs[insurance][‘单位’] for insurance in insurance_costs if ‘单位’ in insurance_costs[insurance])
25 total_costs_individual = sum(insurance_costs[insurance][‘个人’] for insurance in insurance_costs if ‘个人’ in insurance_costs[insurance])
27 insurance_costs, total_costs, total_costs_individual
Cell In[1], line 24, in <genexpr>(.0)
18 insurance_costs[insurance] = {
19 ‘单位’: social_security_base * rates[‘单位’],
20 ‘个人’: social_security_base * rates[‘个人’]
21 }
23 # 计算总费用
—> 24 total_costs = sum(insurance_costs[insurance][‘单位’] for insurance in insurance_costs if ‘单位’ in insurance_costs[insurance])
25 total_costs_individual = sum(insurance_costs[insurance][‘个人’] for insurance in insurance_costs if ‘个人’ in insurance_costs[insurance])
27 insurance_costs, total_costs, total_costs_individual
TypeError: argument of type ‘float’ is not iterable