Hello Thonny
Hello World! using Thonny
Launch Thonny
The default view in Thonny has two panes arranged vertically. The upper pane is the editor; the lower pane is the shell. We will work in the upper pane.
Notice that tab on the upper pane says
<untitled>
. This is because we haven’t saved our work and given our progam a name (yet).In that pane, type
print('Hello World!')
followed by a single return/enter. Make sure you enclose Hello World!
within quotation marks. Make sure there’s an open and closing parenthesis.
Your Thonny window should look like this:
- Now save your program. Click on the save icon as indicated. [1]
Enter the name hello_world.py
in the dialog box, and make a note of the location where your file will be saved (you may change this location if you like).
Notice that we gave the file a name in all lower-case letters, with an underscore between words, and a .py
extension. This is the convention in Python. Other languages may differ, but this is how we name Python files. All the programs you write for this course should follow this convention.
At this point, the save icon should be greyed (indicating that your file is saved), and the tab which earlier was labeled <untitled>
now reads hello_world.py
.
- Now click on the run icon, to run your program.
In the lower pane, you should see the result of running your program. It prints “Hello World!”
That’s it. You’ve written and run your first Python program in Thonny. Welcome to the club!
Copyright © 2023–2025 Clayton Cafiero
No generative AI was used in producing this material. This was written the old-fashioned way.