Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Introducing Dictionaries Introducing Dictionaries Recap of Introducing Dictionaries

dictionaries are ordered, or not ordered?

the first quiz question says dictionaries are not ordered. i understand dictionaries are not indexed by numbers, but that was a different quiz question. what does the first quiz question mean when it says dictionaries are not ordered?

1 Answer

Jeff Muday
Jeff Muday
Treehouse Moderator 28,222 Points

You are indeed correct! Dictionaries are not ordered.

But, sometimes the implementation of Python you are working on will have sorting by key but it is not guaranteed to be such in all Python versions.

You can have an OrderedDicttype. Read about it here:

RealPython "OrderedDict vs dict in Python: The Right Tool for the Job"