5th Feb 2022, 2:04 PM
SERG Starkov
SERG Starkov - avatar
3 Answers
+ 3
Dictionary keys must be unique. When a new value is added to the dictionary, Python first checks if the key already exists, and if it does, the value of the existing key is overwritten. This happens here: 1: "apple", ... True: False, Because True is evaluated to 1 so the apple is overwritten by False. For this reason, it is usually not great to mix different types of data as keys in the same dictionary, particularly int and bool have this conflict.
6th Feb 2022, 4:11 AM
Tibor Santa
Tibor Santa - avatar
0
SERG Starkov whats your question . I don’t get it. Even aftet looking at your code. Dictionary is an unordered sequnce of elements.
5th Feb 2022, 2:05 PM
hamishhr
hamishhr - avatar
0
Look inside code. Section """ Why
5th Feb 2022, 2:06 PM
SERG Starkov
SERG Starkov - avatar