Lists: Ordered and Changeable

Scenario: A queue of services changes as incidents open and close.

New words, in plain English

Lists use square brackets. Index and slice them like strings. append, extend, insert, remove, pop, sort, and reverse modify a list; sorted returns a new list.

Analogy: A Python program is like a clear set of instructions for a careful helper: names label things, indentation groups steps, and errors explain where the helper became confused.

A small, real example

queue = ["api", "db"]
queue.append("cache")
finished = queue.pop(0)
print(finished, queue)
Tip: Copy with items.copy() or items[:] when two independent lists are required.
Goal: Practice this idea in the py-list-basics challenge at /labs/python. Fix the broken program, run it yourself, then use check to prove the real end state.