List.pop(<index>)
Deletes an element from the given position in the list, and returns it.
If no index, pop() removes and returns the last item in the list.
Returns the item being deleted
Raises an exception (runtime error) if the list is already empty
List.index(<item>)
Returns the index of first matched item from the list
If the given item is not in the list, it raises an exception error.
List.insert(<pos>,<item>)
Append() and extend() insert the element(s) at the end of the list
If you want to insert an element somewhere in between or any position of your choice, insert() method is used.
<pos> is the index of the element before which the second argument is to be added
Returns no value
List.remove(<value>)
remove() function removes the first occurrence of given item from the list.
Does not return anything.
pop() removes an element from the list based on index, but to remove an element based on value, remove() is used.
List.clear()
Removes all items from the list .
The list becomes empty after clear() is executed.
Returns nothing.
How is del L different from L.clear()?
del L removes the elements as well as the list.
L.clear() only removes the elements from the List. The List remains. The List object still exists as an empty list.
List.count(<item>)
Returns the count of the item passed as an argument.
If the element is not in the list, it returns 0.
List.reverse()
Reverses the item of the list in place.
No new list is created.
Returns no list.