Before posting, I have already gone through Access an arbitrary element in a dictionary in Python, but I'm uncertain about this.
I have a long dictionary and I've to get the values of its first and last keys. I can use dict[dict.keys()[0]]
and dict[dict.keys()[-1]]
to get the first and last elements, but since the key:value pairs are outputted in a random form(as in the positioning of the key:value pairs is random), will the solution provided in this link always work?