0Pricing
Python Academy · Lesson

Modifying Lists

Append, insert, remove, and sort list elements.

Introduction

Lists are mutable — you can add, remove, and rearrange elements after creation.

append()

my_list.append(x) adds x to the end in O(1). It modifies the list in place and returns None.
lst = [1, 2]
lst.append(3)
print(lst)

All lessons in this course

  1. Creating and Accessing Lists
  2. Modifying Lists
  3. Tuples and Immutability
  4. Nested Lists and Iteration
← Back to Python Academy