0

Dictionaries why False?

In the code blow the key 1 exists. Why do I get False instead of "apple"? https://code.sololearn.com/crBCZ05rwLwg

23rd Apr 2020, 8:57 PM
Χρήστος Καλαμπούκας
Χρήστος Καλαμπούκας - avatar
3 Antworten
+ 4
True, when it comes to dicts, is equivalent to 1. So when you add True as a key to your dict, 1 is overwritten.
23rd Apr 2020, 9:13 PM
HonFu
HonFu - avatar
+ 2
Good Thanks
23rd Apr 2020, 10:06 PM
Χρήστος Καλαμπούκας
Χρήστος Καλαμπούκας - avatar