0
Dictionaries in python
Why when i print this dict print({True:"yes", 1:"no", 1.0:"maybe"}) I only get {True:"maybe"} Not the whole dictionary??
12 Respuestas
+ 4
Yes
+ 2
I guess that python linked all the key together cause all are true keys then picks the last value or most occuring value
+ 1
Just try playing with different value u will see that i mean
+ 1
Both keys and values
+ 1
ᎪᏞᎪ'Ꭺ ᎪᏞᎠᎬᎬΝ ՏᎻᎪᎷᎷᎡ
Because in python 1 and 1.0 and True are same it is replacing duplicate keys value.
Just print these and see:
print (1 == 1.0) #True
print (True == 1) #True
print (True == 1.0) #True
0
Please can i see the code that doing tya
0
Donald🤩🇳🇬
Thanks
0
See your keys are being the same,try with different keys
0
Netha_r2071
It's just one of sololearn challenge questions
0
See true,1,1.0,1.000 all mean the same,and if u want to print then the first key value pair will be printed
- 1
**that