This is wrong with your code: dicts can only contain each key once.
If you specify
d1={1:1,-1:0}
d2={1:2,1:1,1:0}
You get dict
d1
with contains keys 1
and -1
with its values and you get dict
d2
wich contains only 1
as key (with value of 0 as this one was specified last).
Test:
d1={1:1,-1:0}
d2={1:2,1:1,1:0}
print(d1) # {1: 1, -1: 0}
print(d2) # {1: 0} - both of 1:2,1:1 were overwritten by the last key 1:0 spec
2
solved How to iterate through two dictionary objects (both key,value) using two nested for loops in python? [closed]