How to Iterate Through a Dictionary in Python

Dictionaries in Python

Paul Mealus

Paul Mealus 4 Lessons 20m
basics python

Python provides a composite data type called a dictionary, which is similar to a list in that it is a collection of objects.

Here’s what you’ll learn in this course: You’ll cover the basic characteristics of Python dictionaries and learn how to access and manage dictionary data. Once you’ve finished this course, you’ll have a good sense of when a dictionary is the appropriate data type to use and know how to use it.

Dictionaries and lists share the following characteristics:

  • Both are mutable.
  • Both are dynamic. They can grow and shrink as needed.
  • Both can be nested. A list can contain another list. A dictionary can contain another dictionary. A dictionary can also contain a list, and vice versa.

Dictionaries differ from lists primarily in how elements are accessed:

  • List elements are accessed by their position in the list, via indexing.
  • Dictionary elements are accessed via keys.

About Paul Mealus

Paul Mealus

Paul studies ways to leverage technology to empower business and make life better. Paul has a life goal to become a CIO and more importantly, pet every dog in the world.

» More about Paul

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

Daniel on Aug. 13, 2019

Great course.

« Browse All Courses