>>> a = ["a", "b", "c", "d", "e", "f", "g", "h", "l"]
>>> a[30:]
[]
>>> a[:30]
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'l']
I am trying to understand the logic behind this slicing. For example, when we try to reach element by indexing, it will give us an IndexError.
>>> a[12]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
We have got total 9 elements in the list. Yet, we can use any indexes which are greater than 8. Any technical explanations would be highly appreciated.