Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The nth character is the character at index n+1 #167

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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