Built-in List Functions in Python

The following table lists all the functions that can be used with the list type in Python 3.

List Method Description
list.append() Adds a new item at the end of the list.
list.clear() Removes all the items from the list and make it empty.
list.copy() Returns a shallow copy of a list.
list.count() Returns the number of times an element occurs in the list.
list.extend() Adds all the items of the specified iterable (list, tuple, set, dictionary, string) to the end of the list.
list.index() Returns the index position of the first occurance of the specified item. Raises a ValueError if there is no item found.
list.insert() Inserts an item at a given position.
list.pop() Returns an item from the specified index position and also removes it from the list. If no index is specified, the list.pop() method removes and returns the last item in the list.
list.remove() Removes the first occurance of the specified item from the list. It the specified item not found then throws a ValueError.
list.reverse() Reverses the index positions of the elements in the list. The first element will be at the last index, the second element will be at second last index and so on.
list.sort() Sorts the list items in ascending, descending, or in custom order.
Want to check how much you know Python?