Learning Python By Example: #1 in a long series

aka Greg blogs his way through an awesome book

I need to learn (more) Python

I learned the basics of Python a few years back when I taught a class for kids and stayed a chapter ahead in the course book (Al Sweigart’s Invent New Games with Python)… for the few chapters we covered. I have used a bit of it there and again, but when I decided I wanted to learn more of the AI and Data Science tools that use Python, I knew I not only had to knock the rust off my rudimentary skills, I needed to level-up.

I got my first home PC (a VIC-20) in 1981. And the way I really got my hands dirty in BASIC with that VIC (and later a Commodore 64) wasn’t from online courses. It was from reading the Commodore BASIC manual and meticulously typing in programs from magazines like Compute. The act of typing them in, line by line, not only allowed me to see how professional software developers had built these games and demos, but forced me to look at each line and develop a deeper understanding of what was going on in each one.

Just my luck, Al Sweigart read my mind. He came out with a new book, The Big Book of Small Python Projects. In it, he provides 81 Python coding projects, but it isn’t 81 detailed tutorials. It’s just well-commented code with a few review questions as follow-up, so you can read the code and then see how it executes, learning by example.

So tonight we’re gonna Python like it’s 1981

Yes, that’s my #dadjoke way of incorporating a Prince reference. Although he was technically a Boomer, Prince helped write Generation X’s cultural DNA.


I bought Al’s book, and although I can download all the code in a zip file and read it, I chose to actually type in each project. I’ll add my own comments and annotations, maybe do a little experimenting, write up my reactions, and then share the results here on my blog. Thanks to Al’s Generosity (his books are licensed Creative Commons Attribution Non-Commercial Share Alike), I can use the content in my blog posts. And hopefully I’ll be able to add some value.

So let’s party Python like it’s 1981 and get to the first Python project.