Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Here's how I solved it!
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
Welcome back, hope you had a good time
getting your checker board setup.
0:00
While this isn't the most complicated
problem you'll ever come across,
0:03
it's a good bit of exercise and thinking
how to solve problems without writing out
0:06
every single character and piece and
bit of work that you have to do.
0:09
For the first step making the two strings,
0:14
I created a variable named
xo is = to the string xo.
0:16
And then, I multiplied it by 4 and
it basically did the same thing for
0:21
ox, so ox times 4.
0:25
The second step is actually
pretty close to the first.
0:28
I made a new variable that I
named xoxo and it's a list.
0:31
And I put xo inside and then ox and
then I multiplied that by 4.
0:37
Python's ability to let you repeat things
with multiplication is really handy for
0:42
problems like this.
0:46
All right, so
all that's left is the printing part.
0:48
The join method can really
trip a lot of people up.
0:50
And it's because it starts with
a string and not with a list or
0:53
iterable that you're joining.
0:56
It's a little bit unintuitive.
0:59
So, since we wanted to join
all this up with the new line,
1:00
that will be our character, so
that's our string is this new line.
1:04
And then we do the join method and then
we put in the thing that we want to join,
1:10
we wanna join xoxo.
1:15
Now, I need to print this whole thing
up so I wanna come back here to
1:16
the beginning and I'm wanna type
in print ), and that should be it.
1:21
And I'm gonna go ahead and save.
1:25
I should be able to come down here and
do python string manip.py.
1:27
And I should get x's and o's and I do.
1:32
That looks great.
1:35
All right,
I hope you liked this bit of practice.
1:37
Be sure to fill out the feedback survey
about these kinds of practices and
1:38
let us know what else you'd
like to practice in the future.
1:42
If you have ideas for
1:44
other types of practice be sure
to let us know about those too.
1:45
I'll see you next time.
1:48
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