AI engineering glossary · Python core

What is indexing?

Indexing (also called zero-based indexing): Accessing a single element of a sequence by its position, written with square brackets. Python counts from 0, so the first element is at index 0. Using an index beyond the end raises an IndexError.

Level: beginnerTopic: Python core

Indexing: an example

fruits = ['mango', 'apple', 'guava']; fruits[0] is 'mango' and fruits[2] is 'guava'; fruits[3] raises IndexError.

Related terms

More Python core terms

Where you learn it

Indexing is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.