.pop()
christian.dinh2476 total contributions
Published May 5, 2021Updated Sep 3, 2021
Contribute to Docs
Removes an item from a list while also returning it.
Syntax
list.pop(index)
It accepts one optional input which is the index of the element to remove. If no index is provided, then the last element in the list will be removed and returned.
Example
To pop the element 'Discrete Math'
from the courses
list:
Example 2
If no index is provided:
All contributors
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- christian.dinh
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.