How do list indices work in Python ?
Question :
How do list indices work in Python ?
List indices work in the same way as string indices:
(a) Any integer expression can be used as an index.
(b) If we try read or write an element that does not exist, we get an IndexError.
(c) If an index has a negative value, it counts backward i.e., from the end of the list.