Method |
Method Description |
append() |
Adds an element at the end of the list This method is invoked on list object and takes an element as argument.
The argument item is appended at the end of the list |
clear() |
Removes all the elements from the list This method is invoked on list object and takes no argument. |
copy() |
Returns a copy of the list This method is invoked on a list object and takes no value as argument.
It creates a new list with all elements in the invoking list and returns it. |
count() |
Returns the number of elements with the specified value This function takes an element as argument and returns integer value
which denotes how many times the element is present in the list. The method returns 0 if the element is not present. |
extend() |
Add the elements of a list to the end of the current list This method is invoked on a list object and takes another list as
argument value. This method append the elements stored in argument list at
the end of invoking list |
index() |
Returns the index of the first element with the specified value This method takes an element as argument value and is called on a
list object. It searches the element in the list and returns the index if
present otherwise shows error. If the element is present for number of times, it returns the first occurrence
index. |
insert() |
Adds an element at the specified position This function takes an integer value as first argument and element as
second argument. It insert the element in the invoking list object at the
specified index. |
pop() |
Removes the element at the specified position This function takes an integer value as index and removes the element
at the specified index from the invoking list |
remove() |
Removes the item with the specified value This function takes an element as argument and removes it from the
invoking list |
reverse() |
Reverses the order of the list This is zero argument method which reverses the invoking list
elements |
sort() |
Sorts the list This is zero argument method which sorts the elements of the invoking
list |
No comments:
Post a Comment