Getting Started With Lists
00:00 First things first. What is a Python list? The list data type in Python is a built-in data type, meaning it’s available everywhere in your code without using imports.
00:09 And more specifically, it’s a sequence data type, making it a kind of container that holds multiple elements and it’s characterized by having its items enclosed in square brackets.
00:20 Lists are also one of the most versatile containers in Python due to some of the particular properties of lists.
00:27 Some of these properties include being ordered, meaning their elements are arranged sequentially based on insertion order. Zero-based in that they support accessing those sequential elements by index.
00:37 With indices starting at zero. They’re mutable, meaning list objects can be mutated in place. Their elements can be changed, or moved around. This makes them flexible, but it also means that a list can’t be used as a dictionary key or as a value in a Python set because the list’s mutability also makes it what’s known as unhashable.
00:57 Lists are dynamic, capable of growing and shrinking dynamically. And because lists are heterogeneous containers, they can be populated with items of differing types, including other lists, which makes them nestable.
01:11 You can make lists of lists and even use lists to emulate matrices. Lists are iterable. They allow you to traverse their elements using loops and comprehensions.
01:21 They’re sliceable, meaning they support Python’s slice notation to extract a series of elements. And lastly, they’re combinable. They support concatenation operations, letting you combine multiple lists together.
01:34 Alright, that may seem like a lot, but you don’t need to memorize this. We’ll be examining all of these characteristics in depth throughout the rest of this course.
01:43 So follow me to the next lesson where you’ll begin by looking at the primary techniques for creating new lists.
Become a Member to join the conversation.