Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences 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 refer to our video player troubleshooting guide for assistance.

Lists and Tuples in Python: Overview

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:

Python
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

00:00 Hi, my name’s Chris Bailey, and I’ll be taking you through the Real Python course Lists and Tuples in Python. So, what will you learn in this tutorial? You’ll learn the important characteristics of lists and tuples, how to define each of the types.

00:14 You’ll learn manipulation techniques. You’ll also learn the fundamentals of how and when to use each of those types. Here’s a quick overview of lists. 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, like shown below.

00:38 And there’s a set of characteristics about lists: Lists are ordered. Lists can contain any arbitrary objects. List elements can be accessed via an index, and lists can be nested to arbitrary depth.

00:54 Lists are mutable, and they’re also dynamic. Throughout this course, we’re going to cover all those topics. So now, a quick heads up on tuples. Tuples are identical to lists in all respects, except for they’re defined differently; tuples are immutable; and Python has a nice notation for unpacking and packing tuples directly. We’ll dive much deeper into these concepts later in the course.

01:20 Let me take you through the table of contents. It starts here with this intro and course overview. Then it leads into your first video about lists and talking about how they’re ordered

01:35 and they can contain arbitrary objects. Next, you’ll learn about an indexing system for lists and how to take slices.

01:51 Then you’ll learn about using operators with lists and how some of the built-in Python functions work with lists. The next video is about nesting within lists, and how you can have a sublist and another sublist within that.

02:10 The next topic is about how lists are mutable and how they’re also dynamic. Then you’ll start to learn list methods

02:24 and how they modify your list in place. And there are a few other lists methods that actually have return values. Next up, it’s defining and using tuples.

02:42 And after doing basic defining and working with them, you’ll learn about how to do tuple assignment and packing and unpacking of tuples. And the last video is a conclusion and a course review. All right, it’s time to start learning about how lists are ordered and can contain arbitrary objects. That’s in the next video.

Become a Member to join the conversation.