Chapter 17

Collections

Learning Objectives

  • Understand how to work with and manipulate strings
  • Syntax for creating new lists
  • Work with strings and lists using bracket notation, iteration, and common list methods
  • Create and use Python dictionaries
  • Create and use Python tuples
  • Recognize the benefits and drawbacks of dictionaries vs. lists vs. tuples

Key Terminology

Strings

Strings as Collections

  1. character
  2. collection data type
  3. ordered collections
  4. length function
  5. empty string

Bracket Notation

  1. index
  2. bracket notation
  3. substring
  4. slice

Lists

List Basics

  1. list
  2. elements

Working with Lists

  1. mutable

Cloning Lists

  1. aliased
  2. cloning

Lists within Lists

  1. multi-dimensional list
  2. nested list

Dictionaries

Dictionary Basics

  1. dictionary
  2. key/value pairs