list = ['a', 'b', 'c', 'd', 'e']
print (list[10:])
The result of the above lines of code is []
. There will be no errors like IndexError.
Attempting to get a member from a list with an index that exceeds the member count (eg, trying to access the one given in the question list[10]
) raises an IndexError.
By the way, only retrieve slices that exceed the number at the starting index. Items in the list do not cause IndexError. It just returns an empty list.