This line of code
print [0, 1, 2, 3, 4][0:1:1]
returns [0]
.
However, the following line of code:
print [0, 1, 2, 3, 4][0:0:1]
returns []
.
Why is this? Based on this Explain Python's slice notation, my understanding is that the format should be:
a[start:end:step] # start through not past end, by step
So shouldn't [0, 1, 2, 3, 4][0:0:1]
start and end at the 0th value, thus returning [0]
?