Technology • Python

Python Basics: Dictionaries

What Is a Dictionary in Python? A dictionary is a built-in data type that lets you store data in key-value pairs . Instead of accessing values by a number (like in a list), you access them by their label. Syntax When to…

Share this article
FacebookLinkedInX

 

What Is a Dictionary in Python?

A dictionary is a built-in data type that lets you store data in key-value pairs. Instead of accessing values by a number (like in a list), you access them by their label.

Syntax



When to Use Dictionaries

Use them when:

  • When working with Json data
  • This works well with data returned from Database / backend
  • You want fast lookup by a unique key
  • You're organizing settings, user profiles, configurations, etc

Common methods used with dictionaries




See the following code and try it yourself

View embedded content at its source






Originally published on Inspire Innovative Learning.

View the original article
Start a discussion