 <p>There are multiple ways to do what you are trying to do, the easiest one would be the following:</p> <pre><code>OutputDict = {} for key in Dict1.iterkeys(): if key in Dict2: OutputDict[key] = Dict1[key] + Dict2[key][2] </code></pre> <p>Since all the operations are O(1), and we run it for each key on Dict1 (or Dict2 depending) all this runs in O(min(n,m)) where n is the length of Dict1 and m the length of Dict2</p>