Computer Science

Forgetting That List Indexes Start at Zero

Treating the first item in a list as index 1 instead of index 0.

Quick check

Why students make it

People count starting at one in everyday life, so the first item feels like number one.

The rule done right

In most languages the first element is at index 0 and the last is at index length minus 1. A list of 5 items has indexes 0 through 4.