Skip to content

3.1.2 Common List Methods (append / pop / sort)

Lists provide built-in methods that make it easy to add, remove, and organize elements.


append()

The append() method:

  • Adds an element to the end of the list
  • Modifies the list in place

pop()

The pop() method:

  • Removes and returns an element
  • Removes the last element by default
  • Can remove an element at a specific index

sort()

The sort() method:

  • Sorts list elements in ascending order by default
  • Modifies the original list
  • Can be customized for different sorting behaviors

📌 Note:
Most list methods modify the list directly rather than returning a new list.