How to Write Python Programs

All of our programs for The Art of Coding are written in Python. To make writing programs in Python easier, we will be using the integrated development environment (IDE) Thonny. Thonny is free to download and compatible with all systems. Follow the instructions on their website to download Thonny.

Once you have Thonny downloaded, go ahead and open it up! Thonny is a very simplified IDE and only contains the important pieces for Python development.

First up, look at the code section. This is where you will write the bulk of your code when making Python programs. Anything you want to save to a file should go in the main code section.

Next, take a look at the shell section. This is where the output for your program will be.

Write Your First Program

Let’s write our first Python program! Start by copying the code below into the code section of Thonny.

print("Hello World!")

Next, save your program by hitting Ctrl+s. Make sure to save your program in a place you’ll remember it.

To run your program, hit the green play button at the top. When you run this program, you should see Hello World printed out in the shell section.

Congrats! You’ve written your first Python program! Next we will look at some of the basic functionality of Python.