Python Community Interview

Python Community Interview With Al Sweigart

by Ricky White community

This week, I’m joined by Al Sweigart, a familiar name in the Python community. Al is an accomplished developer, conference speaker, teacher, and origamist. (Yes, you read that correctly!) But some may know him best as the author of many Python programming books, including the bestselling book Automate the Boring Stuff with Python and our top pick, Invent Your Own Computer Games with Python. So, without any further ado, let’s get into it!

Ricky: Welcome to Real Python, Al. We’re so glad you could join us for this interview. Let’s start the same way we do with all our guests. How’d you get into programming, and when did you start using Python?

Al Sweigart

Al: Thank you! Heh, I absolutely hate telling people how I got into programming because I was one of those kids who started learning BASIC around the third grade or so.

I don’t like telling people that because I feel like it contributes to the idea that in order to become a programmer you had to have started when you were really young. Like, if you weren’t debugging subroutines as a fetus, there’s no chance you’ll make it a career. So I tell people I started when I was a kid.

I also tell them that most of my programs were pretty mediocre for several years. I didn’t have Wikipedia or Google or Stack Overflow, so I kept making variations of a “guess the number” game, or began projects that I didn’t have the technical knowledge to complete. My head start didn’t amount to much. Everything I learned about programming and computers across several years as a kid and teen could be learned today in about a couple dozen weekends.

I think the main benefit of starting young was that I didn’t know programming was supposed to be hard. Today, everyone thinks of AI and machine learning and video games with amazing 3D graphics. I was just messing around in my spare time in a completely unfocused way, but I was totally fine with that.

I didn’t learn that much knowledge-wise, but I did pick up the idea that programming was just a thing you could learn to do like anything else. It didn’t require super smarts or Olympic-level training to do.

My first programming language was BASIC and soon after Qbasic, but I also picked up a little C, Visual Basic, Perl, Java, PHP, and JavaScript. It seems like a lot, but I never really mastered any of them. I just learned enough to complete whatever project I was working on in those languages at the time.

I got into Python around 2005, and sort of stopped learning new languages after that. I keep feeling the urge to explore new ones (Kotlin, Rust, and Dart have been in my sights for a while), but Python is just so easy to use for so many areas that I haven’t had a strong enough pull away from it yet.

Ricky: You know, my first Python programming book was your book Automate the Boring Stuff with Python. It’s something I still reference, even today. I’d love to know what inspired you to write a book that isn’t necessarily aimed at people who want to be a professional programmer in the traditional sense?

Al: Haha, I’m always amazed at how popular that book has become! I still reference the book myself: I’ll be working on something and can’t quite remember a function name and I’ll realize, “Wait, I wrote this down before.” I really hate job interviews where they forbid you from consulting books or documentation for the coding interview. When I’m programming, I consult books that I wrote.

I got started writing books around 2008 or 2009. My girlfriend at the time was a nanny for a 10-year-old who wanted to learn to code, but I couldn’t find any tutorials for him online that I liked. Everything was either for software engineers or the same old “let’s calculate Fibonacci numbers” stuff.

I thought back to how I got into coding through those magazines and books that listed the source code for small games. I had only half-understood the explanatory text, but copying the source code and making small modifications really showed me how to put programs together.

So I wrote a tutorial like that which grew in length and eventually became Invent Your Own Computer Games with Python. I put it online, then later sold it as a self-published title. I still had my day job as a software developer, and I never really considered book writing to be a career.

I released the book under a Creative Commons copyright license which let people download and share it for free. That turned out to be critically important because it let people share the book and generated word-of-mouth. Without a Creative Commons license, it would have just been yet another self-published listing on Amazon and I wouldn’t have my current career. Making the book freely available resulted in far more sales.

So I wrote another book and another one, and for my fourth book (which would become Automate the Boring Stuff with Python), I signed a contract with No Starch Press. I’ve really enjoyed working with them: their editors are great, their books are all high-quality, and they were fine with me continuing to release titles under a Creative Commons license.

Around 2012, “everyone should learn to code” was making the rounds in the news again, as it seems to have done every five or ten years for the last few decades. And I thought, “Sure, but why?” Not everyone needs to become a software engineer, and nobody needs to calculate Fibonacci numbers.

I thought about what non-programmers could use coding for. Twenty years ago, if you were chatting with your friends online every day, you were probably a huge nerd. But today, you’re just the average Facebook user. Lots of people use computers for their office jobs or at home.

What kinds of things would they like to automate that won’t require a computer science degree? As it turns out, there’s a lot! I have a friend who joked that if you want to become a millionaire startup founder, just find an industry that still uses fax machines and Excel spreadsheets for everything and write the web app that gets adopted by that entire field.

So I had a list of stuff like “update spreadsheets” and “send notification emails,” and all of that became Automate the Boring Stuff with Python. The software developer job I had at the time had gotten a bit stale, so I left it thinking I’d spend a year finishing Automate and then get another software developer job. I’ve been a full-time writer and online course developer for six years now.

It’s been a lot of luck. I’m lucky that hundreds of people have contributed to a free, open-source language like Python that makes programming so easy. I’m lucky I had savings so I could take a chance with book writing. I’m lucky that others have created the free software culture that led to things like the Creative Commons license.

So when people ask me for book-writing advice, it’s kind of like asking a lottery winner what numbers to pick. I still think there’s a lot of needless barriers in our society that need to be torn down to let people reach their full potential, so that aim has been my guiding star.

Ricky: Anyone who has followed you for any amount of time on Twitter will know you have a passion for teaching Python to people learning to code. You particularly seem to like using video games as the entry point. Have you found that focusing more on the “fun” topics has helped you reach more people, and helped them get into Python? And was it intentional, or were you scratching your own itch?

Al: Just the other day I found a slide from Mahmoud Hashemi’s 2019 PyBay talk that was titled “There are two reasons to start wanting to code” and it had a Venn diagram with “I want to make a video game” and “I want to be free of Excel.” Never have I seen my entire teaching and writing career summed up like that before. Video games are an excellent gateway into programming, especially with a tool like MIT’s Scratch. But it’s kind of hard to use video games sometimes.

I’ll be standing in front of a classroom of 9-year-olds and say, “We’re going to make a game,” and they’re thinking of Minecraft or Breath of the Wild or some other title that had a professional development team with a hundred-million-dollar budget, and instead I say, “How about we make a maze or Simon Says game?” It’s all about managing expectations. There’s still the basic fun of creating something, of telling the computer what to do and seeing it do that.

I’ve been working on creating a collection of small, easy to understand, text-based games in Python, which I’ve put online. The idea is that once you know about programming concepts like loops and variables, you can see these used in actual programs with these games.

I shudder when people tell new programmers to get better by reading the code of open source projects because those projects are often massive and poorly documented. Very few of them have onboarding guides to get new volunteers up to speed with the code base, so it’s hard to wrap your head around that code.

New coders just come away from it feeling intimidated. So my simple games are like training wheels on a bike, and the constraints I follow to enforce simplicity are actually pretty good at making me come up with creative but simple programs.

I’m not a game designer by any means. All the games I’ve made are, at most, a few hundred lines of code, and they’ve always been things that are mechanic-heavy like Tetris or that growing worm game everyone had on their Nokia cell phone. These games don’t require a lot in the way of graphics or level design.

I’m in awe of folks like Toby Fox or Eric Barone who spent years on their own creating Undertale and Stardew Valley, respectively. But even those games stand on the shoulders of giants. Undertale and Stardew Valley were inspired by Earthbound and Harvest Moon, but have the benefit of modern game design insights (and overwhelming talent on the part of Fox and Barone).

Likewise, all of my text-based games are similar to the ones you’d find in David Ahl’s BASIC Computer Games book or BYTE Magazine from the 70s and 80s, but with the benefit of a few decades of game design theory. All of this was intentional on my part (I wouldn’t be creating these small games if not for getting a programming tutorial out of them), but I don’t think I could do it any other way; nothing is as good of a hook to get kids and adults into programming as these fun little video games.

Also, anyone who has followed me for any amount of time on Twitter will also know that I have a passion for political rants. I try to stay on the constructive side for those, at least.

Ricky: You are one of the few programmers (and definitely one of only a handful of Python programmers that I know of) that live codes on Twitch. How has that experience been, and what have you learned through the process? Do we need to be encouraging more Python Twitch streamers?

Al: I’ve been streaming off and on over the last couple of years, sometimes with weeks or months in between streams. It’s an unfortunate truth that you essentially have to do it as a full-time job for about a year before you can grow an audience to a size that can sustain a career, and I don’t have that kind of time. But it’s nice as a hobby.

I can stream myself as I work on my small games or as I record myself creating online courses. It lets me practice being on camera while coding and narrating, which is useful for my online video course work. And it puts me in touch with beginners, so I can understand what parts they have trouble with or what questions they have.

Twitch deletes my streams about a week after I stream them and some folks have asked that I archive them somewhere permanent, but I really don’t think of it as much more than something to have on in the background. I’d much prefer creating polished, 10-minute videos than a four-hour stream of me rambling and trying to look up documentation.

Ricky: Now for our last few questions. What else do you get up to in your spare time? What other hobbies and interests do you have, aside from Python and coding?

Al: Spare time, eh? I’m afraid I don’t understand the question…

A nice thing about my current career is that it certainly keeps me busy. Writing programming tutorials pretty much was my side hobby, and now I get to do it full time, with all the benefits and disadvantages that brings. I have enough projects to last me well into 2021, but at the same time, I want them all done now.

The biggest motivation for finishing my current books and videos is that I’ll be able to start on my next book and video. I jokingly asked a friend if starting a cocaine habit would improve my productivity and she said, “Sure, at first.”

But aside from writing programs and writing books about programs, I like doing origami. It’s something I was interested in as a kid, but I’d always get halfway through the folding diagrams in books before reaching a step I couldn’t figure out, and I’d have to abandon it.

This is another thing from my childhood that the internet has improved tremendously: these days, there’s a million origami folding videos online, so I’m able to put together models that are far more impressive than anything I could have done as a kid.

Another friend pointed out that writing software, writing books, folding origami, and essentially all my hobbies have one thing in common: they’re all cheap! Give me an old laptop and a stack of paper, and I’ll be fairly content.


If you want to see what Al is up to, you can reach out to him on Twitter and say hi. His blog and his plethora of books can be found on his website, Invent With Python. Thank you, Al, for talking to me!

If you have someone you’d like me to reach out to for an interview, leave a comment below and let me know.

🐍 Python Tricks 💌

Get a short & sweet Python Trick delivered to your inbox every couple of days. No spam ever. Unsubscribe any time. Curated by the Real Python team.

Python Tricks Dictionary Merge

About Ricky White

Ricky is a software engineer and writer from a non-traditional background. He's an enthusiastic problem solver with passion for creating and building, from software and websites to books and bonsai.

» More about Ricky

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Master Real-World Python Skills With Unlimited Access to Real Python

Locked learning resources

Join us and get access to thousands of tutorials, hands-on video courses, and a community of expert Pythonistas:

Level Up Your Python Skills »

Master Real-World Python Skills
With Unlimited Access to Real Python

Locked learning resources

Join us and get access to thousands of tutorials, hands-on video courses, and a community of expert Pythonistas:

Level Up Your Python Skills »

What Do You Think?

Rate this article:

What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment below and let us know.

Commenting Tips: The most useful comments are those written with the goal of learning from or helping out other students. Get tips for asking good questions and get answers to common questions in our support portal.


Looking for a real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

Keep Learning

Related Topics: community