TypeError Traceback (most recent call last)
Cell In[1], line 14
6 proportion = {
7 ‘养老保险’: 0.08, # 个人缴纳8%
8 ‘医疗保险’: 0.02, # 个人缴纳2%
9 ‘失业保险’: 0.005, # 个人缴纳0.5%
10 ‘工伤保险’: 0.002 # 个人缴纳0.2%
11 }
13 # 计算社保缴费总额
—> 14 total_social_security = sum([base * rate for base, rate in proportion.items()])
15 total_social_security
Cell In[1], line 14, in <listcomp>(.0)
6 proportion = {
7 ‘养老保险’: 0.08, # 个人缴纳8%
8 ‘医疗保险’: 0.02, # 个人缴纳2%
9 ‘失业保险’: 0.005, # 个人缴纳0.5%
10 ‘工伤保险’: 0.002 # 个人缴纳0.2%
11 }
13 # 计算社保缴费总额
—> 14 total_social_security = sum([base * rate for base, rate in proportion.items()])
15 total_social_security
TypeError: can’t multiply sequence by non-int of type ‘float’