The following code include the last number.
>>> numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> numbers[::3]
[1, 4, 7, 10]
Why does not includet the last number 2, like 10, 8, 6, 4, 2?
>>> numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> numbers[:1:-2]
[10, 8, 6, 4]
It seems that the slice operator is simply non-inclusive of the second argument. In other-words, your
1should be a0:Hope that helps 🙂
For further info, see Note 5 here.