Error in the dictionary key: pairing?
I believe there is an error in the dictionary created during this video showing the two sum solution.
The dictionary shown is :
d = {2:0, 5:1, 3:2, 7:3, 4:5}
I believe it should be
d = {2:0, 5:1, 3:2, 7:3, 4:4}
1 answers ( 0 marked as helpful)
Hi Vishal,
I think you might be correct - there's no reason for the list indexes (which are given by the values in the dictionary) to skip a position.
Perhaps Giles was checking for attention to detail :), but more likely a minor error when writing out the dictionary by hand.
In any case, good pick.