List Index
noun
say it: “LIST IN-deks” /lɪst ˈɪndɛks/
An item's position in a list, counting from 0, so the first item is at index 0.
What is a list index?
A list index is an item's position in a list. Counting starts at 0, so the first item is at index 0.
songs = ["Intro", "Chorus", "Outro"]
print(songs[0]) # Intro
print(songs[2]) # Outro
In a sentence
- “songs[0] uses list index 0 to get the first song.”
- “An IndexError means the list index is past the end.”
Level: Apprentice · More Python terms at this level
Updated