TypeError Traceback (most recent call last)
Cell In[1], line 14
5 social_security_rates = {
6 ‘养老保险’: {‘个人’: 0.08, ‘单位’: 0.20},
7 ‘医疗保险’: {‘个人’: 0.02, ‘单位’: 0.09},
(…)
10 ‘生育保险’: {‘单位’: 0.008},
11 }
13 # 计算个人社保缴费总额
—> 14 personal_social_security = sum([base * rate[‘个人’] for base, rate in social_security_rates.items() if ‘个人’ in rate])
15 # 计算单位社保缴费总额
16 company_social_security = sum([base * rate[‘单位’] for base, rate in social_security_rates.items() if ‘单位’ in rate])
Cell In[1], line 14, in <listcomp>(.0)
5 social_security_rates = {
6 ‘养老保险’: {‘个人’: 0.08, ‘单位’: 0.20},
7 ‘医疗保险’: {‘个人’: 0.02, ‘单位’: 0.09},
(…)
10 ‘生育保险’: {‘单位’: 0.008},
11 }
13 # 计算个人社保缴费总额
—> 14 personal_social_security = sum([base * rate[‘个人’] for base, rate in social_security_rates.items() if ‘个人’ in rate])
15 # 计算单位社保缴费总额
16 company_social_security = sum([base * rate[‘单位’] for base, rate in social_security_rates.items() if ‘单位’ in rate])
TypeError: can’t multiply sequence by non-int of type ‘float’