0Pricing
Learn AI with Python · Lesson

Dictionaries

Master the use of key-value pairs to store and retrieve data efficiently.

1

Introduction to Dictionaries

Dictionaries in Python are collections of key-value pairs. They allow you to store and retrieve data efficiently using keys.

In this lesson, you’ll learn how to create, manipulate, and iterate over dictionaries.

Dictionaries — illustration 1

2

Creating Dictionaries

A dictionary is created using curly braces {}, with key-value pairs separated by colons:

# Creating a dictionary
person = {"name": "Alice", "age": 25}
print(person)

All lessons in this course

  1. Lists
  2. Tuples
  3. Sets
  4. Dictionaries
  5. Strings as Data Structures
← Back to Learn AI with Python