Posts tagged

Lists

Lists and Arrays: Storing Collections of Data

Introduces Python lists as ordered, mutable collections and walks through creation, zero-based indexing, negative indexing, and common methods like append, insert, remove, and pop. Also covers list comprehensions for concisely generating filtered or transformed lists, nested lists for representing matrices, and the array module as a memory-efficient alternative for homogeneous numeric data. Concludes with a practical to-do list manager exercise that reinforces add and remove operations interactively.

Arrays and Lists: Mastering Collections in Python

A thorough introduction to Python lists covering creation with mixed types, element access and slicing, and the full set of list methods including sort, reverse, count, and index. Explains list comprehensions for filtering and transforming data, nested lists for 2D data structures, and the array module for typed, memory-efficient numeric storage. The practical section builds a to-do list manager, and a Tic-Tac-Toe challenge invites readers to apply nested lists to model a game board with win detection.