+ 6
[Solved] 1, 1.0, True
In this following code, I expect to get the output: "apple" but I don't know why python gives me the output "False". Can anyone tell me why? pairs = {1: "apple", "orange": [2, 3, 4], True: False, None: True, } print(pairs.get(1)) "Thank you guys for your answers, now I got it and understood dictionaries better." 🌹❤ Case Solved. ✅
4 Respuestas
+ 12
True
1.0
1
have the same hashvalue.
Therefore pairs[1]=pairs[1.0]=pairs[True]=False
+ 5
Thank you. 🌹
+ 3
Please print out pairs to see for yourself.