我正在尝试运行一个 for 循环。这是我遇到问题的代码部分:
aldurstengd_ororka = {(18, 19, 20, 21, 22, 23, 24):1, (25):0.95, (26):0.90,
(27):0.85, (28, 29):0.75, (30, 31):0.65, (32, 33):0.55, (34, 35):0.45,
(36, 37):0.35, (40, 41, 42, 43, 44, 45):0.15, (46, 47, 48, 49, 50):0.10,
(51, 52, 53, 54, 55):0.075, (56, 57, 58, 59, 60):0.05, (61, 62, 63, 64,
65, 66):0.025}
for age in aldurstengd_ororka.keys():
for item in age:
if ororkualdur == item:
baetur = baetur + ororkulifeyrir * aldurstengd_ororka([age])
所以我的意图是遍历aldurstengd_ororka,并且对于字典中的每个“年龄”元组,我为元组中的每个“项目”运行另一个for循环。我得到的错误是
TypeError:“int”对象不可迭代