You will get this error when there is no list element to access.
For example,
L=[1, 2, 3]
L[4] doesn’t exist.
If you try to call L[4], you will get the above error.
Python list and tuple, both of them consists of multiple objects identified its position.
list
tuple
T=(1,2,3)
Difference between them is that tuple is immutable.
That is,
L[0]=100
is OK, but
T[0]=100
is not allowed.
Python list
isĀ a container that holds a number of other objects, in a given order.
L=[1, 2, 3, 4]