Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Python Sequences!
You have completed Python Sequences!
Preview
Discover slicing in Python.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
The start and stop values refer to
the index of elements in a sequence.
0:00
You're already familiar with
the syntax for slicing.
0:03
It's very similar to the syntax for
0:06
accessing an individual
element of a sequence.
0:08
You're just expanding on it by telling
the interpreter to access several
0:11
elements of the sequence by telling
you where to start and stop.
0:14
And if you want, adding a step value.
0:18
A start value of 1, for
0:20
instance, will create a slice that begins
with the second element in the sequence.
0:22
And a stop value of 4,
0:26
means the sliced sequence will end at
the fifth element in the sequence.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up