Function Details: pop_(list)

Description


Removes and return item at index (default last).


Extended Description


The pop() method removes and returns the item at the specified index from the list. If no index is specified, it removes and returns the last item. If the index is out of range, it raises an IndexError. This method modifies the list in-place, reducing its length by one.


Function Signature


list.pop(index: int = -1) -> Any

Module: list

Class: list

Parameters



Parameter List


  • index: int

Return


Returns the item that was removed from the list.


Return Type


Any

Output

Explanation

This example shows how to use pop() to remove and return the last item from the list.