Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

What Is a Dictionary in Python?

Give Feedback

Dictionaries are Python’s implementation of a data structure that is more generally known as an associative array. A dictionary consists of a collection of key-value pairs. Each key-value pair maps the key to its associated value.

You can define a dictionary by enclosing a comma-separated list of key-value pairs in curly braces ({}). A colon (:) separates each key from its associated value:

d = {
    <key>: <value>,
    <key>: <value>,
      .
      .
      .
    <key>: <value>
}

Comments & Discussion

Harsha Vardhan on Jan. 2, 2020

From Python 3.7, Dictionary order is guaranteed to be insertion order.

Before Python 3.6, we have to use OrderedDict from collections module.

Am i correct here ?

Thank you Paul

Become a Member to join the conversation.