0

List index out of range?

What does it mean when a list index is out of range in python?

3rd Feb 2017, 11:20 PM
John Shafe
John Shafe - avatar
3 Antworten
+ 5
If you try to access a non-existent item in a list, that's the error that's thrown. Ex: If you have a list with 5 items, it has indexes 0 (the 1st item) through 4 (the 5th item). If you use index 5 (what would be the 6th item), you're going out of bounds of the list.
3rd Feb 2017, 11:26 PM
Tamra
Tamra - avatar
+ 2
that you have specified an element that is not exist in your list, or probably you're wrong with index(first element is 0)
3rd Feb 2017, 11:26 PM
IONUT MARCIUC
IONUT MARCIUC - avatar
0
Okay, thankyou
3rd Feb 2017, 11:28 PM
John Shafe
John Shafe - avatar