Skip to content

Commit

Permalink
Merge pull request #167 from anharrington/master
Browse files Browse the repository at this point in the history
The nth character is the character at index n+1
  • Loading branch information
presnick authored Jan 7, 2019
2 parents a08b77d + 97b922c commit 6ce8c0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions _sources/Sequences/TheSliceOperator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ selecting a character:
print(singers[17:21])


The ``slice`` operator ``[n:m]`` returns the part of the string from the n'th character
to the m'th character, *including the first* but *excluding the last*.
In other words, start with the character at index n and
go up to but *do not include* the character at index m.
The ``slice`` operator ``[n:m]`` returns the part of the string starting
with the character at index n and
go up to but *not including* the character at index m.
Or with normal counting from 1, this is the (n+1)st character up to and including the mth character.

If you omit the first index (before the colon), the slice starts at the
beginning of the string. If you omit the second index, the slice goes to the
Expand Down

0 comments on commit 6ce8c0f

Please sign in to comment.