Lesson 25. Working with lists

After reading lesson 25, you’ll be able to

  • Build Python lists
  • Add items, remove items, and modify items in Python lists
  • Perform operations on list elements

Mutable data types are types of objects on which you can perform operations, such that the object’s value is modified; the modification is done in place, so to speak, so no copy of the object is made. There’s a need for data types that are mutable, especially when working with large amounts of data; it’s more efficient to modify data stored directly instead of copying it into a new object with every operation.

Instead of creating new objects, it’s sometimes useful to reuse an object and modify its value. This is especially true when you have an object that ...

Get Get Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.