dic = {3: 0.1, 4: 0.2, 5: 0.1, 6:0.2, 7:0.1, 8:0.2} ls = {0.2, 0.1, 0.2, 0.1, 0.2, 0.1} n = {} for i, v, l in list(dic.keys()),list(dic.values()),ls: add = v + l n[i] = add # expected result {3: 0.3, 4: 0.3, 5: 0.3, 6:0.3, 7:0.3, 8:0.3} print (n)I'm trying to use keys, values of dic and entries of ls at the same time, can I do that?
I'm not sure why it's not correct ?
Wait, I can only have one element after in ?