Lists

A list holds items in order: wells = ["A01", "A02", "B01"]. Positions start at 0, so wells[0] is the first item. Negative positions count from the end, so wells[-1] is the last.

Lists are mutable. You can change an item in place with wells[1] = "A03" and grow the list with wells.append("B02"). len(wells) gives the length, and "B01" in wells checks whether an item is there.

Asking for a position past the end raises IndexError. It is one of the most common errors in interview code, usually from an off-by-one loop like range(len(xs) + 1).

A list can hold any mix of types, but in practice you keep one kind of item per list.

Run the code, then try wells[-4] to see where negative positions stop.