As you saw in the last chapter, strings can be thought of as a collection of letters all connected to make something. This chapter we will introduce: lists, tuples, and dictionaries. All of these are ways we can create collections in Python.

Objectives

Upon completion of this chapter’s exercises, you should be able to:

  • Describe sequences of data.
  • Use lists and tuples to store groups of values.
  • Extract individual values and subsequences of values from a sequence.
  • Manipulate lists to add new items, remove items, sort them, and reverse them.
  • Apply the concept of key-value pairs to build a dictionary containing values about named entities.
  • Understand that sequences may be values in a sequence, like any other value.