- [Instructor] In this self check exercise
I'd like you to use some of the techniques we demonstrated
in the preceding video,
to locate all words starting with t in the string,
to be or not to be that is the question.
So go ahead and create that loop
and make sure it works,
and then come back to see my answer.
Okay, let's go ahead and reveal that answer.
As you can see here, we created a for loop
that is going to assign to the target variable
the result of this expression,
to be or not to be that is the question dot split.
So as you may recall, the split method is going
to break apart the string into individual tokens
by default at the whitespace characters
and that will give me back a list of strings.
For every word in that list,
we're going to check the word
to see if it starts with the letter lowercase t
and if so, we will print that word,
separated from the next by a space.
So if I go ahead and execute that,
you can see we get to to that the.
And we have to to that and the
are the four words within the original string
that started with a lowercase t.