O'Reilly logo

Learn to Program with Python 3: A Step-by-Step Guide to Programming by Irv Kalb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Irv Kalb 2018
Irv KalbLearn to Program with Python 3https://doi.org/10.1007/978-1-4842-3879-0_11

11. Data Structures

Irv Kalb1 
(1)
Mountain View, California, USA
 

Let’s start this chapter with a definition.

Definition

A data structure is a collection of multiple pieces of data, arranged in a way that the data can be accessed efficiently.

The only data structure we have discussed so far is a list. A list allows us to refer to any one of multiple pieces of data using an index. Python has a few more built-in data structures.

This chapter covers the following topics:
  • Tuples

  • Lists of lists

  • Representing a grid or a spreadsheet

  • Representing the world of an adventure game

  • Reading a comma-separated value (.csv) file

  • Dictionary

  • Using the in operator on a dictionary ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required