Calmcode - comprehensions: unique

Unique

1 2 3 4 5 6 7 8 9

When dealing with dictionary comprehensions you should note that the keys of the dictionary must be unique.

Note how this dictionary has 7 key-value pairs.

{i: c for i, c in enumerate('abcdefa')}

While this dictionary only has 6.

{c: i for i, c in enumerate('abcdefa')}