Learn Python the Hard Way for Physical Computing – Lessons 1-10

learn-python-the-hard-wayAs promised, I’ve been diligently working through the book “Lean Python the Hard Way,” by Zed A. Shaw.  My eventual goal is to be able to write scripts allowing me to interface with the real world, or at least automate some stuff.  I keep thinking that some early version of Windows (maybe 3.0) had a “Macro” function, where you could make it record your commands and play them back later.  I never understood it, as I was 10 or so at the time, but the idea continued to appeal to me.  Python seems like it could be a good solution for repetitive tasks like this.

As of now, I’ve worked through lessons 1-10 out of 52 total.  Probably the hardest thing about the lessons is the tendency to want to skip ahead and just get to the “fun stuff.”  The other temptation is to simply copy and paste stuff out of Zed’s lessons and past them into your text editor.  This is explicitly forbidden (by all the power that a person you’ve never met on the Internet has over you) as you really won’t learn anything that way.  Maybe that’s why it’s “The Hard Way,” however, I tend to agree with him.

The lessons themselves start out with setting up your text editor and command line in either Windows, Mac, or Linux.  I’m using Ubuntu, so Python was happily already installed on my system.  I installed Ubuntu in a pinch (as seen in this series of posts), but I seem to enjoy using it more and more as the months pass.  The multiple-workspace feature is really great, as I can read the lessons in one workspace, press ctrl-alt-rt_arrow and type it in on the next (if that makes no sense to you, check out the video at the end of the post).

The stuff in the first 10 lessons may seem very elementary to someone with any programming background (as a Mechanical Engineer mine is limited), but I think it’s important to learn and practice what you are doing when learning something new.  It’s mostly about printing and formatting stuff and some elementary math operations.  A full explanation of what you’ve done in the lesson isn’t always given, but that seems to be part of the teaching technique.  At it’s core, everything so far has been a matter of typing in what he says to.  “Extra credit” is given to expand on what you’ve done, and I think it’s important to at least look at and understand it, as well as the “Frequently Asked Questions” section after the lessons.

Like anything else academic, you get out what you put into it.  I believe I’m getting a good Python background, even if I still just want to jump right into the advanced stuff.  So at nearly 1/5 done with the book in under a week, I’m quite pleased so far.  We’ll see how I feel after lesson 20!

Here’s a video about how multiple workspaces work in Ubuntu if you’re interested:


  1. The Python Programming Language For Physical Hacking - Hack a Day - pingback on September 4, 2012 at 10:58 pm
  2. Learn Python The Hard Way Lessons 21-30 - pingback on September 20, 2012 at 7:21 pm

Trackbacks and Pingbacks: