Getting Started with Programming (using Thonny)

I thought it could be worth while to go through a quick “first program” using Thonny. If you didn’t see my last blog post, Thonny is a python code editor designed for people brand new to programming. You can download it here: https://thonny.org/

It’s easier than it looks.

The first time you open up Thonny, you get a pretty simple window with two mostly empty panels. The upper panel is where you write your code, and the lower panel is where you see the results of your programs and interact with them while they are running. So, let’s write our first program.

In the upper panel, write the line below, exactly as it is written.

print("It works!")

That’s it! You’ve written your first program. To run it, click the green circle with a white triangle inside it (the fourth icon in the row of icons above the upper panel). In general, this will simply run your program, but the first time you click it on a new file, it will ask you to save the file first. I recommend creating a new folder either on your desktop or in your documents folder, where you can save all of your Thonny projects. For simplicities sake, let’s call this “project1” and then click the “Save” button in the lower right corner of the save window.

Thonny will then save the file and run the program. When that happens, the lower panel should look very similar to this:

If you don’t see the words “It works!” in the middle, but see something in red instead, there was probably a typo in your code. Go back and double check that it is exactly like I typed it above (you can even copy and paste if you need) and then click the green Run button again.

What’s going on here?

There are two important things to know about what we’ve just done.

Firstly, we used a function called print(), which prints onto our screen whatever we put in between the brackets. Functions are like micro-programs that only do one thing. Most programs have many functions in them. We will make our own functions at some point, but most programming languages come with many functions built-in (the print() function is built into Python, which is the name of the programming language we’re using in Thonny), and some functions are written 

Secondly, the programming term for what we wrote between the brackets is called a string. Strings are like normal text/words. To write a string, you just need to put everything you want to be part of that string between two quotation marks. You can use double quotes, “like this,” or single quotes ‘like this.’ But whichever you use at the start of the string has to be the same as what you use at the end.

So, in the end, all we did was tell our computer to print the string “It works!” onto our screen. Simple. No, it’s not very exciting, but we’re just taking this slow, to make sure we can get a clear understanding of each step of the process.

Tomorrow (or soon after), we will tackle something called variables.

Programming Tools for Beginners

The first time I tried explaining how to get started with programming, I found that I spent an awful lot of time explaining how to get the right tools installed and configured just to be able to get to the point where the first line of code could be written. Since then, I’ve figured out which tools are better (or, at least, simpler) than others for people who are just getting started. But, just the other day, I stumbled across something that seems like it could be a terrific starting point for someone who just wants to get their feet wet without having to deal with the hassle of getting their computer set up for programming.

The Simpler the Better

It’s a program called Thonny. It is free and comes with everything you need to get started with programming in a single tidy little package. All you have to do is download it from thonny.org, install it onto your computer, and start it up. Then, there within that little window is everything you need to actually write your own programs.

Keep in mind, this is designed for total beginners. If you are already familiar with programming and file structures and things like that, this might be a little too “basic” for you, but it is actually still kind of fun if you want to check it out.

I think tomorrow (or some time very soon) I’ll do a quick-and-dirty “how to” with Thonny. Let’s have some fun!

Programming is Easy

It is actually seriously easy. It’s one of the easiest skills to pick up. It’s easier (and quieter) than learning to play the piano. It’s easier (and safer) than learning carpentry. If you are smart enough to do a Google search, you’re smart enough to learn to program.

Why I’m Doing This

I have heard a lot of people say that they wished they were smart enough to be a programmer. And some people have even asked me to help them get started. The most important thing I learned while teaching people to program was that most of the stuff I learned in school is not useful at all. When I stopped trying to explain technical details, and just showed them how to actually write programs, it turns out that it’s actually not difficult at all. And, better yet, it can be fun!

Recently, I was trying to find something online to help someone get started with programming, but there wasn’t a whole lot out there. Yes, there are literally thousands and thousands of books and websites where you can learn to program, but they all seemed to be one of two things. They were either very complicated and overwhelming for someone without a computer background, or they were over-simplified websites that were more like constant quizes, and didn’t actually let you create anything you could use anywhere. So, I decided to write this little guide that will actually show you how to do real programming, and let you see just how easy and fun programming can be.

Why Programming Seems So Hard

Programming is often taught as a science, like physics or chemistry. In fact, people spend enormous amounts of money to learn about computer science at university. And, before the internet was wide-spread, it was pretty difficult to find “easy” ways to learn to program, so programming was mostly done just by really smart people who have an almost unatural ability to understand how things work. Plus, since computer science was built on the foundations of mathematics, a lot of people who were math experts gravitated towards programming, because they could see the similarities and could intuitively figure out how things worked.

So, if it looks like only really smart people are getting into programming, and if it looks like people are spending thousands of dollars and many years of their lives trying to figure it out, than no wonder so many people think that programming must be hard.

Why It’s Actually Very Easy

Think of programming like driving a car. When you drive, you’re controlling a seriously complicated machine, but all the technical details of the machine don’t really matter to you as the driver. You don’t need to understand how the engine works, let alone the mathematics of mechanical dynamics. All you actually need to do is press the gas and brake pedals at the right time, and of course steer.

The same goes for programming. You don’t need to learn about the science behind it all to be able to “do” it (though you certainly can). You just need to know what to actually do. So, that’s what I’m going to show you in the coming weeks and months and who knows how long.

I hope you’re looking forward to it as much as I am.