Introducing the Practice1:31 with Kenneth Love
Create two similar strings, repeat them in a list, then join the list with a newline character and print it out.
[MUSIC] 0:00 Hey everyone, just wanted to give you a little practice working with strings, 0:04 lists, and the join method, cuz they can be a little tricky. 0:08 There's a workspace attached to this video that you should open up. 0:11 If you want to work locally, you can download it through the File menu 0:14 in this Download Workspace link right here. 0:18 So in this file, I've included instructions for what to do for 0:21 this bit of practice. 0:24 There are three major steps. 0:25 Let's talk about them real quick. 0:26 First, I need you to make two strings. 0:28 They should both be made out of alternating x's and o's, but 0:31 the first one should start with x, and the second one should start with o. 0:33 Make them both eight characters long. 0:37 This is a good place to embrace your inner programmer laziness and use Python's 0:39 string multiplication abilities to reduce how much typing you do. 0:43 Secondly, make a list. 0:47 This should have eight items in it too, four each of your X-started strings and 0:49 four of your O-started strings. 0:53 Again, make sure they alternate. 0:56 And again, get lazy and use some multiplication. 0:57 Finally, print out that whole list, but join the list into a single string first. 1:01 Use the join method and 1:08 a string with a new line character in it, which looks just like this. 1:09 Yeah, it's two characters, it's a slash and a n, but together they're 1:13 just a single character that makes your terminal hop down to the next line. 1:18 When you're done you should end up with something that sorta kinda looks 1:22 like a chess or checker board. 1:25 Have fun with it, and I'll see you in the next video with how I did this. 1:27
You need to sign up for Treehouse in order to download course files.Sign up