Just out of curiosity really. As an example, the following code in python
astring = 'abcdefg'
print(astring[0:3])
returns
abc
which is the first three indices of the string. But since the indices start at zero, we have that astring[0]
is included in the substring but not astring[3]
. Why? Wouldn't make more sense to have astring[0:3]
be equal to 'abcd'
?