0

Print dictionary

Why this code: print({True:'yes',1:'no',1.0:'maybe'}) give this output: {True:'maybe'} https://code.sololearn.com/cO1XLHqsdi2q/?ref=app

16th May 2020, 9:38 PM
Bogdan Roshnivskyi
Bogdan Roshnivskyi - avatar
2 Antworten
+ 3
overwriting of previous values when you have keys with same value or name ,keys should be unique and True 1 or 1.0 evalutes to 1 https://discuss.codecademy.com/t/can-a-dictionary-have-two-keys-of-the-same-value/351465
16th May 2020, 9:48 PM
Abhay
Abhay - avatar
16th May 2020, 10:14 PM
Petr