Learn Python The Hard Way Lessons 21-30

pvc-hexapod-floor

PVC hexapod – not Python powered… Yet.

In case you’d though I’d given up on leaning Python, here’s my thoughts on LPTHW lessons 21-30!

Lessons 1-20 were all about copying the text that Zed gives you in Learn Python the Hard Way and running it.  Lessons 21-30 is where you finally have to start thinking for yourself somewhat.  The important thing is not to give up, even though the lessons may take you much longer than they did in lessons 1-10, or even lessons 11-20!

Lesson 21 is a “look and hand copy” lesson teaching you about functions that can return a value.  Lessons 22 and 23 are a bit more ambiguous as the first invites you to go through all the previous lessons and copy down every word and symbol that you’ve used.  Lesson 23 invites you to simply read some code.  Excercises 24 and 25 go into the copy mode again, this time practicing defining functions more.

Exercise 26 is where people may get tripped up.  Zed gives a program that he’s written sloppily, and you’re expected to fix it.  It didn’t take me that long to do this, but I do similar troubleshooting in my job as an engineer, so it took about an hour.  The key seems to be trying to run it after each “fix” and see where the console gives you an error.  It may take some people longer to get this to run, but even after that’s done, there’s some grammar mistakes that you may or may not see.  It’s possible I never go this one correct, but it looked pretty good to me.

CNC router – just waiting to take advantage of the Python programming language

Fortunately, once you get through this, lessons 27 and 28 are about memorizing and using logic, so this shoudn’t be too hard for anyone with a rudimentary programming background.  29 and 30 go back to “look and hand copy” mode again, this time about conditional “if” statements.  Things are taking longer to copy than they did at the beginning, but it’s not unreasonable yet.  Looking ahead, it appears there are a few lessons with longer text files to copy.  You may be half-done at this point numerically, but I get the feeling that time-wise that may not be the case.

Either way, I’ve enjoyed this book, and look forward to the day that I can sit down and write code for my CNC router, Programmalble LED array, or robot that I haven’t even thought of.  I feel like I could probably write some useful code myself now.  It’s tempting to just start trying to “hack something out.”  I have done some of that, like trying out the pyMCU Python real world interface (their site), but for the most part I’ve stuck to the lessons.

As a side note, if you’d like to check out the Hexapod featured in the first picture, here’s my first post on it.  Still not finished, but maybe soon…

Comments are closed.