Python: List Method

In Python, there are many in-built function which can be used in list to perform certain task some of them are:

  • append(): It is use to add element in the end of a list. Example
  • clear(): It is use to remove all the elements from the list. Example
  • copy(): It is used to return a copy of the list.
  • count(): It is used to return the number of elements in the list.
  • del(): It is used to delete the element mentioned using list name and index number. Example
  • extend(): It is used to add elements in the end of the given list. Example
  • index(): It is used to return the index of element in the given list. Example
  • insert(): It is used to add an element at specified position. Example
  • len(): It is used to return the length of the list.
  • max(): It is used to find max of all elements in a list.
  • min(): It is used to find the min of all elements in a list.
  • pop(): It is used to remove all the elements of the specified position. Example
  • remove(): It is used to remove the specified value. Example
  • reverse(): It is used to reverse the order of list.
  • sort(): It is used to sort the list. Example
  • sum(): It is used to return the sum of all elements in a list.
Tags