Login
📚 Introduction to Python Programming
Chapters ▾
⇩ Download ▾

9.1 Modifying and iterating lists

Learning objectives

By the end of this section you should be able to

  • 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.