Skip to main content

Create a list

Create an empty list

Access an element in a list

Access an element in a list using negative index

Access a range of elements in a list

Add an element to a list

Add an element to a list at a specific index

Remove an element from a list

Remove an element from a list

  • at a specific index
  • using del

Remove all elements from a list

Check if an element is in a list

Get the length of a list

Sort a list

Sort a list in reverse order

Reverse a list

Copy a list

Join two lists

  • using extend

Remove duplicates from a list

Set is a collection of unique elements. set is used to remove duplicates from a list.

Find the index of an element in a list