Lists

19 articles
Interview Preparation Intermediate

10.19 Hands-on Exercises

Practice programs reinforcing Python list concepts -- an inventory manager class, a todo app, a log analyzer, a CSV processor, and mini …

Jan 20, 2026 Read more
Interview Preparation Intermediate

10.18 Interview Questions

Frequently asked and scenario-based Python list interview questions covering list vs tuple, append() vs insert(), sort() vs sorted(), …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.17 Best Practices

Preferring a list comprehension over a manual loop when it stays readable, choosing append() over insert(0, ...), converting to a set for …

Jan 20, 2026 Read more
Interview Preparation Intermediate

10.16 Common Mistakes

The most common list bugs in Python -- off-by-one IndexError, silently skipping elements by mutating a list while iterating over it, and the …

Jan 20, 2026 Read more
Interview Preparation Intermediate

10.15 Lists in DevOps

Lists as the natural in-memory shape of file and log contents, plus real infrastructure patterns -- server inventories, filtering Amazon EC2 …

Jan 20, 2026 Read more
Interview Preparation Intermediate

10.14 Common Algorithms

Classic list algorithms built from tools covered earlier in this chapter -- reverse, order-preserving deduplication with dict.fromkeys(), …

Jan 20, 2026 Read more
Interview Preparation Intermediate

10.13 Performance

The time complexity of every core list operation, why a list uses somewhat more memory than an equivalent tuple, and why append() is O(1) …

Jan 20, 2026 Read more
Interview Preparation Intermediate

10.12 Sorting and Searching

sort() vs sorted() -- in-place versus a new list -- plus linear search (works on any list, O(n)) and binary search (requires a sorted list, …

Jan 20, 2026 Read more
Interview Preparation Intermediate

10.11 Copying and Mutability

Why b = a shares one list instead of copying it, the list-specific shallow-copy shortcuts (copy() and l[:]), how mutation is visible through …

Jan 20, 2026 Read more
Interview Preparation Intermediate

10.10 Nested Lists and Matrices

Creating, accessing, and updating nested lists using chained indices, iterating a 2D matrix row by row, and why [[0]*n]*n builds a matrix of …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.8 Built-in Functions

Global functions that accept a list as an argument -- len(), max(), min(), sum(), sorted(), any(), and all() -- as distinct from methods …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.7 List Methods

A consolidated reference for every built-in list method, grouped by what it does -- add (append, extend, insert), remove (remove, pop, …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.6 List Operators

Concatenation and repetition build brand-new lists, membership testing is a linear scan, and comparison works element-by-element and …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.5 Removing Elements

The four ways to remove items from a list -- remove() by value, pop() by index (which returns what it removes), clear() to empty it, and the …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.4 Modifying Lists

Updating an element by index, growing a list with append() and extend(), inserting at a position, and replacing a whole range at once with …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.3 List Indexing and Slicing

Positive and negative indexing, chaining indices into nested lists, IndexError, and slicing with l[start:stop:step] -- including reversal, …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.2 Creating Lists

Empty lists, list literals, the list() constructor, splitting a string into characters, materializing a range(), and building nested or …

Jan 20, 2026 Read more
Interview Preparation Beginner

10.1 Introduction to Lists

What a list is, its core characteristics, why it's Python's general-purpose array, and how it's actually stored in memory as a resizable, …

Jan 20, 2026 Read more