Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The reason is because negative indexing starts counting from the end of the list. In this case, the negative index -1 refers to the last element of the list, and since the slice goes up to but not including the same index (-1), there are no elements left to include in the resulting list.