0
Why 3rd line gives output False??
pairs = {1: "apple", "orange": [2, 3, 4], True: False, None: "True", } print(pairs.get("orange")) print(pairs.get(7)) print(pairs.get(1)) Output: [2,3,4] None False
2 Respostas
+ 1
print(pairs)
# {1: False, 'orange': [2, 3, 4], None: 'True'}
You see, `True` is considered as `1` when you use it as a key.
So `1: "apple"` is overrided.
And you got `False`.
0
Thanks