string = "ABCDEFGH"
Can anyone explain why in string[start:end:stride]
the start always starts from 0
while end starts with 1
.
For example
string[0:3:1]
outputs the result as "ABC"
. As you can see I said end = 3
so shouldn't the string[0:3:1]
be "ABCD"
because computer read 0
first?
And one more thing why: I don't get a result for
string[0:8:-1]
. Shouldn't it be "HGFEDCBA"
? I don't know if it is wrong syntax
or not but I can print
the result of string[::-1]
.