Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Lists and Tuples in Python: Overview

Give Feedback

In this lesson, you’ll get an overview of what you’ll learn in this course. A list is a collection of arbitrary objects, much like an array in other programming languages. Lists are defined by enclosing a comma-separated sequence of objects in square brackets:

a = ['spam', 'egg', 'bacon', 'tomato']

Here are the important characteristics of Python lists:

  • Lists are ordered.
  • Lists can contain any arbitrary objects.
  • List elements can be accessed by index.
  • Lists can be nested to arbitrary depth.
  • Lists are mutable.
  • Lists are dynamic.

Tuples are identical to lists in all respects, except:

  • Tuples are defined by enclosing the elements in parentheses (()) instead of square brackets ([]).
  • Tuples are immutable.
  • Tuples can be packed and unpacked.

Download

Course Slides (PDF)

1.2 MB

Comments & Discussion

Become a Member to join the conversation.