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.