+ 9
Why does this code written true,maybe ?
Dict1={True:'Yes',1:'No',1.0:'Maybe'} Dict2={1:'No',1.0:'Maybe'} print(dict1) print(dict2)
2 Respuestas
+ 5
Hi! I found this on Real Python:
“First, a given key can appear in a dictionary only once. Duplicate keys are not allowed. A dictionary maps each key to a corresponding value, so it doesn’t make sense to map a particular key more than once. If you specify a key a second time during the initial creation of a dictionary, then the second occurrence will override the first.”
Source (2020-08-02): https://realpython.com/lessons/restrictions-dictionary-keys-and-values/
Regards /Per B