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 Introduction to Data Structures!
You have completed Introduction to Data Structures!
Preview
A common operation on every data structure is the ability to search for data stored. In this video let's add a search method that let's us search for a particular item of 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
if the value is found or none if it isn't.
0:00
So right after, actually you know what
we'll make sure repr is the last function,
0:01
or last method in our class,
so we'll add it above it.
0:08
So here we'll say def search self and
then key.
0:12
In the last video,
0:17
we implemented the repr method to provide
a string representation of the list.
0:17
So we're going to use similar logic
here to implement the search function.
0:22
We'll start by setting a local variable
current to point to the head of the list.
0:27
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