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
Count and Index are two other Python sequence methods that give us useful information about our sequence data.
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
And then finally, where or what index
a particular object falls in a sequence.
0:00
A method is just a function that
is called on a specific object.
0:03
Sequences, like most everything in Python,
are objects.
0:06
And they have special methods
that can be called on them.
0:09
For the first part of this video,
we'll be talking about the count method.
0:12
Count is a built-in sequence method.
0:16
It receives one argument,
the object that we're counting.
0:18
Let's pick up with the last example.
0:21
Now that we know the string
tuple is inside docs,
0:23
let's figure out how
many times it appears.
0:25
To use the count method,
0:28
we'll first provide the sequence
we wish to count from.
0:29
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