O'Reilly logo

Python Phrasebook: Essential Code and Commands by Brad Dayley

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

Chapter 3. Managing Data Types

Python has about two dozen data types built in to the interpreter. The three data types that you will need to understand the best and use the most to manage data are the list, tuple, and dictionary.

A list in Python is simply an ordered collection of objects. The objects can be named any legal Python name and the list can grow dynamically to support the addition of new objects. The objects in a list can be of different types and Python will keep track of the data type of objects in the background. Lists in Python are ordered sequence types. Elements of a list are accessible using a zero-based non-negative integer index.

A tuple in one sense is just a read-only version of a list. It is also an ordered sequence of objects. ...

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