Lesson 26. Advanced operations with lists

After reading lesson 26, you’ll be able to

  • Build lists whose elements are lists
  • Sort and reverse list elements
  • Convert a string into a list by splitting on a character

A list is typically used to represent a collection of items, frequently but not necessarily of the same type. You’ll see that it may be useful for the list elements to be lists themselves. For example, suppose you want to keep a list of all the items in your house. Because you have many items, it’ll be more organized to have sublists, where each sublist represents a room, and a sublist’s elements are all the items in that room.

At this point, it’s important to take a step back and understand what has been going on with this new mutable ...

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.