Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Engineering LibreTexts

10: Dictionaries

( \newcommand{\kernel}{\mathrm{null}\,}\)

  • 10.0: Introduction
    This page introduces Python dictionaries, a data structure for storing data in key-value pairs. It explains how to use dictionaries, including methods for looping through items and applying conditional statements.
  • 10.1: Dictionary Basics
    This page discusses the structure and properties of Python dictionary objects, emphasizing the unique characteristics of key-value pairs. It outlines learning objectives related to identifying dictionary types and highlights that while duplicate values are allowed, duplicate keys are not. The section provides examples and practical checkpoints to reinforce understanding, concluding with an encouragement to explore variable types further.
  • 10.2: Dictionary Creation
    This page explains how to create dictionary objects in Python, covering methods like using curly braces and the dict() function for empty dictionaries. It provides examples for initializing dictionaries with key-value pairs, exercises on dictionary syntax, and tasks involving tuples and keyword arguments. The section ends with a practical assignment to create a personal information dictionary.
  • 10.3: Dictionary Operations
    This page discusses Python dictionaries, highlighting their mutability and methods for accessing, modifying, and evaluating items. It explains how to obtain keys, values, and items using functions such as keys(), values(), and items(). Techniques for adding, updating, and deleting entries are demonstrated, including square bracket notation and the update() method. The section includes practice questions to enhance understanding of dictionary operations.
  • 10.4: Conditionals and Looping in Dictionaries
    This page outlines learning objectives for using dictionaries in Python, emphasizing conditional statements and loops. It explains how to check for key and value existence with conditionals and illustrates iteration over dictionaries with for loops. The text includes methods for retrieving keys, values, and key-value pairs, along with practice questions to reinforce understanding of these concepts.
  • 10.5: Nested Dictionaries and Dictionary Comprehension
    This page outlines learning objectives for nested dictionaries and dictionary comprehension in Python. It defines nested dictionaries, illustrated with an organizational chart, and explains dictionary comprehension for efficient dictionary creation. Additionally, it includes practice concepts and programming exercises focused on manipulating nested dictionaries and using dictionary comprehension to transform data.
  • 10.6: Chapter Summary
    This page outlines the features of Python dictionaries as key-value pair containers, highlighting the dict type, unique keys, mutability, creation methods, and item management. It explains accessing values through square brackets or the get() method, iterating through dictionaries, using nested dictionaries, and creating dictionaries via comprehension.


This page titled 10: Dictionaries is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by OpenStax via source content that was edited to the style and standards of the LibreTexts platform.

  • Was this article helpful?

Support Center

How can we help?