0
How does this work? pairs = {1: "apple", "orange": [2, 3, 4], True: False, None: "True", } print(pairs.get("orange")) print(pairs.get(1)) print(pairs.get(12345, "not in dictionary")) the output is [2, 3, 4] False not in dictionary
4 Antworten
+ 1
thank u
0
thats because true is also 1. if you erase true=false then at print(pairs.get(1)) the output will be "apple".
0
how could I do when I want to keep all the element?
0
try put 2: "apple" and then print(pairs.get(2))