Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 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 Respostas
+ 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