Learn Python the Hard Way

Posted on 2016-10-15 in story • 2 min read

My first steps with Python

I’ve been programming for a number of years now, with the majority of my time spent writing VBA tools for our CAD system. For my birthday this past spring, I got Javascript for Kids. I was introduced to No Starch Press recently at our local Barnes & Noble, and thought that this particular book might be useful for myself and (potentially in the future) for my kids.

In the process of researching no starch, I happened across a title Automate the Boring Stuff with Python. This concept resonated deeply with me, as the primary motivator of my programming work to date has been aimed at automating manual (and sometimes boring) workflows.

I’m still working through the javascript book, but have taken an interest in starting to learn python as well. In addition to the boring stuff book, there are a handful of other reasons for heading in this direction. For instance, I’ve noticed that python appears to play a starring role in the Raspberry Pi ecosystem.

I’ve crossed paths with python a number of times in the past, generally in the context of Linux. I seem to have absorbed some of the ‘just a scripting language’ bias in the past, but now I’m ready to take a fresh look.

Learn Python the Hard Way

So, here I am. I’ve surveyed the internet for resources providing instruction on getting started with python. I happened across Zed Shaw’s Learn Code the Hard Way series and have quickly dug into the python flavor.

I have been following the instructions to the letter and now have a working install of python, with Atom as my editor. As expected, it has been slow going as I start climbing the learning curve. I eventually worked my way up to this tidbit, which is example 5.

his_name = 'Zed A. Shaw'
his_age = 35 # not a lie
his_height = 74 # inches
his_weight = 180 # lbs
his_eyes = 'Blue'
his_teeth = 'White'
his_hair = 'Brown'

print "Let's talk about %s." % his_name
print "He's %d inches tall." % his_height
print "He's %d pounds heavy." % his_weight
print "Actually that's not too heavy."
print "He's got %s eyes and %s hair." % (his_eyes, his_hair)
print "His teeth are usually %s depending on the coffee." % his_teeth

# this line is tricky. Try to get it exactly right
print "If I add %d, %d, and %d I get %d." % (
    his_age, his_height, his_weight, his_age + his_height + his_weight)

Conclusion

So, I’m officially on my way to learning python. Things are going slow, of course, but I feel like I’m quickly acclimating to the whitespace. I really like this course! It seems to be very straightforward, and I like the philosophy of putting in your time and not looking for shortcuts. Of course, months from now, I will look back and marvel at the simplicity of the code I wrote in these first few days with the language.