pairs = {1: "apple", "orange": [2, 3, 4], True: False, None: "True", } print(pairs.get("orange")) print(pairs.get(7)) p

not in dictionary is not in pairs. why the have it in the result. it should be none.

3/26/2019 6:33:21 PM

Smail Benloukil

1 Answer

New Answer


"Not in dictionary" is not the output, it is more like an error. Because you are trying to get the value on "7" key. But actually, there is no key named "7" in your dictionary, so the system is telling you that the requested key is "not in dictionary"