3/18 Output Question


I just have a simple question about the output of this section.
My code is…

my_dict = {“Name”:“Eric”,“Age”:“26”}
for key in my_dict:
print key, my_dict[key]

And this is my output.

Age 26
Name Eric

So my question is why is it printed in this order and not the order that I put in the dictionary?


you used python for this right ?


yes, this is python code

@epicpenner33, because dictionaries are accessed by key, so there is no reason to keep the order. Each data type has its advantages and drawbacks.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.