Learn Python the Hard Way for Physical Computing – Lessons 11-20

Learn Python the Hard Way bookIn my quest to learn a language that will hopefully allow me to write interesting scripts for my CNC router, light painting, and maybe even automating some online tasks, I’ve been going through “Learn Python the Hard Way” by Zed A. Shaw.  I keep thinking that the guy is Australian or maybe a Kiwi, because of his name, but he apparently lives in the US.  That being said, I was surprised that Zed is listed under “Living Persons” in the Wikipedia page for Zed.  Apparently he’s a pretty big deal.

The contents of these lessons go from asking people questions and working with variables (11 – 14), working with files (15 – 17), and starts to get into working with functions (18 – 20).  Don’t expect to fly through these lessons as quickly as 1-10, as they’re a bit longer.  Everything is copy and past look and manually copy, so unless you have some spelling or syntax errors, you shouldn’t have a problem getting these lessons done.  It will just take a little longer.

As with the first lessons, extra credit is given that asks you to think through what you’ve done.  In my opinion, ifyou don’t at least look at the extra credit and think about how you would do it, you’re at best not getting as much out of these lessons as you could.  If you don’t understand it at first, that’s OK according to Zed. apparently you’ll get better through seeing it, but I still try to understand it if I can.

You may start to see some useful applications already, as it shows you how to generate a text file.  Although it hasn’t gone into it yet, I would assume that with the correct looping and inputs, you could generate Gcode for a CNC router, or even write code to control a light bar for light painting.  You won’t be ready to do this yet, but here’s some code that a guy wrote (it’s in French – “Le script python”) to transfer a picture to code that a strip of LEDs could read using an Arduino.  I’m not there yet, but something like this would be my end goal.


  1. The Python Programming Language For Physical Hacking - Hack a Day - pingback on September 5, 2012 at 8:02 am

Trackbacks and Pingbacks: