Python for Absolute Beginners Transcripts
Chapter: Problem solving techniques for writing software
Lecture: Practice time

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now it's time for you to get some practice.
0:02 Remember, without practice you do learn some stuff
0:05 but not as much of course.
0:07 And boy do we have a cool example
0:09 that you can start from scratch
0:10 and really build out in this chapter.
0:12 We're going to go and do basically what I described.
0:15 I'm going to give you a problem.
0:16 Maybe somewhat like something you've seen, but not the same
0:19 and you'll be able to apply things like divide and conquer
0:21 and go through it and build it out.
0:23 I think you're going to have a lot of fun.
0:26 Here we are in the GitHub repository
0:28 and let's go down
0:29 its got the standard overview.
0:30 The core concepts are me laying out
0:32 my problem solving techniques.
0:35 Here they are. Divide and conquer.
0:37 Have you seen a similar problem before?
0:39 Visualize the data.
0:40 That could be at
0:42 it could be in the debugger
0:43 as we just discussed.
0:44 It could be just calling print
0:45 and passing the data, whatever works.
0:47 Visualize the data.
0:49 Think through the data structures that might apply here.
0:52 Is there a PyPI package?
0:53 This is an external package that solves this problem.
0:56 And you might also check Awesome Python.
0:58 More on that in a moment.
0:59 And remember, if you feel stuck working through this
1:02 that's part of the journey
1:03 and it's also the reason it's so cool
1:05 to have something nice working at the end
1:07 because you had to slog through a little bit of it, right?
1:10 So it's the payoff there as well.
1:12 And finally, just start. Get going.
1:15 You can use your refactoring tools
1:16 and refactoring and rewriting ideas
1:18 to make it better once you learn more.
1:20 Now, what are you going to build?
1:21 Well, there is a game called Connect Four.
1:24 This is a game by Hasbro
1:26 and it looks like this.
1:28 The idea is you basically drop items
1:30 different colored chips
1:32 into the top.
1:33 And whoever gets four
1:34 as they pile up here
1:36 either diagonally, horizontally, or vertically
1:38 wins the game.
1:39 Kind of like tic-tac-toe
1:40 a little more complicated
1:42 but in terms of the way the code works, not very much.
1:44 Here's some info on wikipedia
1:46 and over here you can actually play it online.
1:48 So your goal is to start from scratch
1:50 and build this, right?
1:53 So think about what you saw in the videos.
1:54 Have I seen a similar solution?
1:55 Choose the right data structure
1:57 run through your choices there
1:59 and break the problem into smaller parts.
2:02 Divide and conquer, just like we did in tic-tac-toe.
2:05 This one will probably take you awhile.
2:07 If you get it done in less than an hour
2:09 and you're new to programming, I'll be impressed.
2:11 So be prepared to put a little effort into it
2:14 but I think it's going to be a lot of fun
2:15 to have when you're done.
2:17 So it's probably not going to be super fast to solve
2:19 and you know, that's part of the journey.
2:21 So now, create a new project and just start.
2:24 That's the recommendation.
2:25 Alright, before you actually start, one more thing.
2:27 I told you one of the techniques
2:29 it doesn't apply in this problem
2:30 but in general, if you're trying to accomplish something
2:34 and you've used your divide and conquer bits
2:36 to break it down
2:37 and then you realize there are some steps that are like
2:39 Download this webpage.
2:41 Understand all of the content, and find this thing.
2:44 You could do a really lot of hard work there
2:48 or you could check PyPI over here.
2:50 This is where all of the Python libraries are
2:52 and you can see there's 215,000 different libraries.
2:55 There might be one that solves that problem.
2:58 So we could actually check.
2:59 Let's suppose we want to go to a website
3:00 download it, and understand it
3:02 and ask questions about the data that's on the page.
3:05 We could look for web crawling
3:07 and that's one of the terms
3:08 or web scraping is another.
3:10 Awesome, there's a bunch of stuff here.
3:11 However, there are 10,000 plus different libraries.
3:15 Whoa! Which one's good?
3:17 You want to try 'em all out?
3:19 I don't know.
3:20 You can also drop in over here
3:21 and sometimes they'll have a category
3:23 for what you're looking for.
3:24 For example, web crawling.
3:27 And down here they list many
3:28 once you finally get there
3:29 many of the popular ones.
3:31 They have MechanicalSoup.
3:32 They have Scrapey
3:34 some various other ones.
3:35 Visual scraping with Scrapy and whatnot.
3:37 Beautiful Soup is also another option
3:40 which kind of a derivative of this.
3:42 I'm not sure why that's not listed there.
3:44 Probably should be.
3:45 But these are some of the more popular ones
3:47 in that category.
3:48 So when it comes down to step five
3:51 is there a PyPI package?
3:52 Maybe use things like Awesome Python to help
3:56 narrow down the search
3:57 if you don't know where to go.
3:59 Alright, get to it.
4:00 Go build a Connect Four clone and have a lot of fun.