October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Python List Methods: A Practical Guide to All 11 Methods

Learn when to use each Python list method, including append versus extend, remove versus pop, sort versus sorted, and the limits of copy().
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Python lists have 11 built-in methods for adding, removing, finding, ordering, and copying items. The key choice is usually whether you want to change the existing list or produce a value to use elsewhere: most list methods that change a list return None, while pop() returns the item it removes.

Python list methods at a glance

The following methods are documented for Python lists in the Python 3.14.7 tutorial. “Mutates” means the method changes the existing list rather than creating a replacement.

Method Use Result and notable failure
append(x) Add one item at the end Mutates the list; returns None.
extend(iterable) Add each item from an iterable Mutates the list; returns None.
insert(i, x) Insert an item before position i Mutates the list; returns None.
remove(x) Remove the first item equal to x Mutates the list; raises ValueError if no equal item exists.
pop([i]) Remove and retrieve the item at position i; defaults to the last item Returns the removed item; raises IndexError for an invalid position or an empty list.
clear() Remove all items Mutates the list; returns None.
index(x[, start[, stop]]) Find the first matching item, optionally within a slice range Returns its index in the whole list; raises ValueError if no match is found.
count(x) Count items equal to x Returns an integer.
sort(key=None, reverse=False) Order the existing list Mutates the list; returns None.
reverse() Reverse the current order Mutates the list; returns None.
copy() Make a shallow copy Returns a new outer list whose nested objects are shared.

These behaviors and signatures are described in the Python 3.14.7 tutorial, “Data Structures”.

How to add items: append, extend, and insert

Use append() for one item

append(x) places its argument at the end as a single element. If that argument is itself a list, the nested list remains one item:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
items = ["red", "blue"]
items.append(["green", "yellow"])
# ['red', 'blue', ['green', 'yellow']]

Use extend() for items from an iterable

extend(iterable) adds the iterable’s elements one by one. To add the colors as separate elements, pass the list to extend() instead:

items = ["red", "blue"]
items.extend(["green", "yellow"])
# ['red', 'blue', 'green', 'yellow']

In short, append(collection) adds the collection as one item; extend(collection) adds the collection’s contents.

Use insert() for a position

insert(i, x) places x before index i. For example, items.insert(1, "amber") puts "amber" at index 1 and shifts the later items along. Use append() when the item belongs at the end; use insert() when its position matters.

How to remove items: remove, pop, and clear

Use remove() when you know the value

remove(x) deletes the first item equal to x, not every matching item. It raises ValueError if the list contains no equal value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use pop() when you need the removed item

pop(i) removes and returns the item at index i; leaving out the index removes the last item. Because it returns the item, you can save it for later:

tasks = ["draft", "review", "publish"]
next_task = tasks.pop()
# next_task is 'publish'; tasks is ['draft', 'review']

An out-of-range index raises IndexError, as does calling pop() on an empty list.

Use clear() to empty the existing list

clear() removes every item from the list. It changes that list in place and returns None.

How to inspect a list: index() and count()

Find a position with index()

index(x) returns the index of the first item equal to x. Optional start and stop arguments limit where the search occurs, but the result is still an index in the original list. If no matching value is found in the search range, the method raises ValueError.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Count matches with count()

count(x) returns the number of items equal to x, including zero when there are no matches.

How to reorder a list: sort(), sorted(), and reverse()

Use sort() to change the existing list

sort() orders the list in place and returns None. The optional key function determines the value used for ordering, and reverse=True requests descending order:

names = ["Mina", "Alex", "Jo"]
names.sort(key=len)
# names is ['Jo', 'Mina', 'Alex']

Elements must be orderable under the comparison or key used. If Python cannot compare the relevant values, sorting fails rather than inventing an ordering.

Use sorted() to make a new ordered list

If the original list must remain unchanged, call sorted(items). It returns a new sorted list instead of modifying items. Do not assign the result of items.sort() expecting a sorted list; that result is None.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use reverse() to flip the current order

reverse() reverses the sequence as it stands; it does not sort values into ascending or descending order. Like sort(), it changes the existing list and returns None.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to copy a list: copy() and nested values

copy() creates a new outer list, but it is a shallow copy. If the list contains mutable objects such as other lists, both the original and the copy refer to those same nested objects. Changing a nested object through one list is therefore visible through the other; copying the outer list does not recursively duplicate its contents.

original = [[1, 2], [3, 4]]
duplicate = original.copy()
duplicate[0].append(99)
# original is [[1, 2, 99], [3, 4]]

Why list methods often return None

Methods such as append(), insert(), remove(), sort(), and reverse() change the list directly. The Python tutorial explains: “You might have noticed that methods like insert, remove or sort that only modify the list have no return value printed – they return the default None.” This is why chaining an in-place operation as though it produced a list can cause errors.

Choose the method by the task

  • Add one item, including a collection as a single nested item: append().
  • Add the elements of an iterable: extend().
  • Insert one item before a particular position: insert().
  • Remove the first matching value: remove().
  • Remove an item by position and keep its value: pop().
  • Empty the list: clear().
  • Find a first matching position or count matches: index() or count().
  • Sort the existing list or make a sorted copy: sort() or sorted().
  • Reverse the current sequence: reverse().
  • Make a shallow outer-list copy: copy().

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.