Python's ordered, mutable sequence: creating lists, indexing them from either end, and updating, adding to, joining and deleting from them.
No account needed to read a lesson · 30-day money-back guarantee
See the full learning path7
lessons
63
practice questions
23
prerequisite lessons
1 of the 7 lessons here is free to preview - the whole explanation and worked example, with no account and no email.
The editor you get
A still of the editor, not a live one
Python Editor
Editor Output
Output:
['z', 'b']
You write and run Python in the browser - nothing to install, no setup. Questions are marked on the values your code produces. The snippet here is an example of the kind of code you write.
The 7 lessons in this unit. Expand any one to see what it covers. Each unlocks when its own prerequisites are passed.
01
Lists
12 questions
Understand what lists are in Python, how to create them using literal values of various types including nested lists, and how to determine their length using the len() function.
Covers
List overview
Creating a list using literal values
Length of a list
02
List indexing
12 questions
Learn how to use zero-based and negative indexing to access elements in a Python list and understand what causes an IndexError when accessing invalid indices.
Covers
List indexing
Indexing nested lists
IndexError
03
Updating list elements
8 questions
Learn how to update individual elements or slices of a Python list using indexing and slicing, including replacing sections with iterables of different lengths.
Covers
Update element in a list
Update list slice
04
Add elements to a list
12 questions
Learn how to add elements to Python lists using the append, extend and insert methods to control both the content and position of inserted items.
Covers
Add element to a list
Extending a list
Insert list element
05
List concatenation
4 questions
Learn how to combine two or more Python lists into a new list using the + operator, preserving the order of elements and leaving the original lists unchanged.
Covers
List concatenation using +
06
Delete elements from a list
8 questions
Learn how to remove elements or slices from a Python list using del, .pop(), .remove(), and slice assignment to modify the list's contents.
Covers
Delete element from a list
Delete list slice
07
Activity: playlist builder
7 questions
Learn how to use Python lists and their associated methods to create, modify, and combine playlists by adding, updating, and removing songs.
Covers
Creating a playlist
Adding songs
Updating songs
Removing songs
Combining playlists
Creating mini-playlists
A new party playlist!
This unit is part of our Python Done Right learning path, which contains 100 lessons. Every one of them is drawn below.
The diagnostic test lets you skip any lesson you already know, including the ones in this unit.
Hover any dot to name its lesson.
7 lessons in this unit
23 prerequisite lessons across the unit, counting every step back to the start
70 other lessons in the learning path - after this unit, or alongside it
Builds on: Assorted extras, Sequences, Tuples
Leads to: Assorted extras, Built-in functions, Comparisons, Loops, Sequences, Tuples
One subscription covers every learning path, and you can test out of anything you already know.
One subscription covers every learning path · 30-day money-back guarantee
More in Data structures: Tuples, Dictionaries, Sets