Good observation!
In the Python version used by Dataquest, dictionaries are unordered. So, the output order can be different than the one you coded.
Yes, I think this might be a mistake in the content.
An odd “gotcha” is when we mix integers with Booleans as dictionary keys. The hash()
command converts the Boolean True
to 1
, and the Boolean False
to 0
. This means the Booleans True
and False
will conflict with the integers 0
and 1
. The dictionary keys won’t be unique anymore, and Python will only keep the last key-value pair in cases like that.
Based on some quick experimentation, in the case of such a clash, it takes the first key and the last value instead of the last key-value pair
mentioned in the Mission Step. (cc - @Sahil)
Note: Please make sure to include the Mission/Mission Step link in your future posts as well.