List Slicing doesn't work as expected

l = [1,2,3,4,5,6,7,8,9]
print(l[:4:-1])

what my logic says is - start from 0 th position i.e value 1, and need to start move left (as the step is -1) and stop when I get index 4, so python doesn’t get index 4 while he started moving left direction, so it should not print anything in output, but the output is - [9, 8, 7, 6]
Can somebody please explain how this works?
Thanks,
Bidhan

In Python slicing, the notation start:stop:step is used to define the range of indices to extract from a sequence. The range includes the start index but excludes the stop index.

In your case, when using a negative step value, such as -1 in "[:4:-1], the start and stop indices are reversed. This means that the start index becomes greater than the stop index.
In [:4:-1] starts from index 4 and iterates towards the beginning of the list in reverse order, but the start index is excluded in the iteration.

Example:
Number[Index]
1[0],2[1],3[2],4[3],5[4] ,6[5],7[6],8[7],9[8]
Index[4] = 5 so it the iteration excludes 5 and the result is as you said [9, 8, 7, 6]