IndexError

The exception raised when you use an index beyond the end of a string, list or tuple.

In more detail

The message is usually string index out of range or list index out of range. The cause is almost always an off-by-one mistake, such as using len(s) as an index when the last index is len(s) - 1. Slices never raise it; they just stop at the end.

Related terms

Taught in

References

Certification courses