Modify a list using append, remove, and pop list operations.
Search a list using a for loop.
Using list operations to modify a list
An append operation is used to add an element to the end of a list. In programming, append means add to the end. A remove operation removes the specified element from a list. A pop operation removes the last item of a list.
Iterating lists
An iterative for loop can be used to iterate through a list. Alternatively, lists can be iterated using list indexes with a counting for loop. The animation below shows both ways of iterating a list.
Adapted from Introduction to Python Programming by OpenStax (openstax.org), licensed under CC BY-NC-SA 4.0. Changes were made. License: CC-BY-NC-SA-4.0.
These eBooks are a prerelease and are not yet certified conformant with WCAG 2.1 AA or ADA Title II. Every page is built against an automated accessibility gate, and the published editions will meet ADA Title II requirements when they release in late September 2026. If something is unusable, please tell us.