Python's Not (Just) For Unicorns

An interactive introduction to programming in Python, for human beings and whoever else

Chapter 1

Introduction

Hi, I’m Soma, and we’re going to learn to program. Hooray!

You’re excited! You’re out of your mind with joy! You’re super pumped and totally jazzed and you’re jumping up and down at your computer and you’re sure it’s going to be incredible!

Except, uh, here’s a secret: programing isn’t very fun. It isn’t! I might even say it’s boring. I mean, yes, it’s just my opinion, blah blah blah, but I’m pretty confident that while we’re learning how to code every ten or twenty minutes you’ll think about how you’d rather be sitting in a nice comfortable chair in the sunshine eating ice cream.

But… you aren’t sitting in a nice comfortable chair in the sunshine eating ice cream. At least not yet. You’re here! You’re learning to program! And you’re still excited!

…why?

Well, here’s another secret: even though programming isn’t exciting, the stuff you can do with programming is awesome and amazing and fantastic and totally the best. That’s why I program. I don’t like spending hours making sure my ( and ] and : and ; are all in the right spots, but do I love the fact that once I finally get it right - magic happens!

I think that programming is a tool like using a saw is a tool. You probably don’t just saw wood when you’re bored, but if you want to build an awesome piece of furniture, it’s time to saw some boards. Sawing by itself? Not so exciting. Sawing for a reason? Totally awesome.

To help keep yourself on your programming quest, an important question to ask yourself is why are you learning to program?

Back when I was a kid in like 1066 A.D., I learned to program because I wanted to make games. Later, I learned to program all over again because I wanted to make websites. Then I did it a third time to build fancier, cooler, more exciting websites, and a fourth time to make fancier, cooler, more exciting games. And then again to make data visualizations, and then again to analyze data to find secrets hiding inside. And probably a few more times, too.

And that’s where I am now! Somewhere in there I wanted to program to make money, so I went to school for it, too. 1

But back to you! You probably aren’t learning to program because someone said programming is cool. You’re learning to program beacuse you want to create something.

And this gives us our third secret, which is kind of an obvious one: learning to program is even less fun than programming is. If you’ve tried before, you probably fell asleep after 10 minutes and woke up with your face stuck to your keyboard. You thought about sitting in the sunshine and eating ice cream, and then you got up and… sat in the sunshine and ate ice cream. It wasn’t a hard decision.

I think this is because barely anyone who teaches programming thinks about why you’re learning to code. You aren’t learning to code so you can add two numbers together2 or make a box pop up on the screen that says “Hello world” or print out all of the prime numbers below 100. If that boring stuff is all we’re doing, no wonder Python can only be learned by special magic unearthly beings with a single horn growing out of their head! I’m pretty sure Python’s not (just) for unicorns, though, it’s for everyone. And everyone has a reason for learning.

We know you’re learning to program to build games! or visualizations! or web sites! or whatever other million things there are3! So let’s just do that, as soon as possible. Let’s think about it this way: I’m not teaching you to program, I’m teaching you to do the things you want to do, or solve the problems you want to solve.

We’re going to have the most fun ever in life, I promise.

…uh, except, well, yes, I’m also going to have you do a lot of super boring things. Yes, you will probably fall asleep on your keyboard a few times. Yes, you’ll think about sitting in the sunshine eating ice cream. But since I don’t care about you getting a gold star for being Emperor of Computer Science, we’re going to take the fastest route I can think of to getting you building your projects.

[1] Going to school for programming isn’t a requirement for money-making, by the way. I don’t think I’ve ever used “in-school” programming to pay my bills.

[2] I’m definitely making you add two numbers together in like ten minutes. #hypocrisy

[3] If you don’t have a project in mind it’s no big deal - I have some ideas, too!