Hello IDLE
Hello World! using IDLE
Launch IDLE
The default view in IDLE is a window for Python shell, so to create a new Python file, you’ll need to use the IDLE menu.
Select “New File” from the “File” menu.
![](assets/idle_hello_1.png)
This will open a new editor window, so you should see something like this:
![](assets/idle_hello_2.png)
- In that window, enter the following Python code:
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 IDLE editor window should look like this.
![](assets/idle_hello_3.png)
- Now save your file. Select File | Save As… from the IDLE menu.
![](assets/idle_hello_4.png)
- When the dialog box opens, enter the file name
hello_world.py
, and make a note of the location where your file will be saved (you may change this location if you like). Click “Save”.
![](assets/idle_hello_5.png)
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.
- Now your file is saved. To run your file, select “Run | Run Module…” from the IDLE menu.
![](assets/idle_hello_6.png)
When your program runs, IDLE should bring the shell window to the front. The result should look like this.
![](assets/idle_hello_7.png)
That’s it. You’ve written and run your first Python program in IDLE. Welcome to the club!
Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >
This material is for free use under either the GNU Free Documentation License or the Creative Commons Attribution-ShareAlike 3.0 United States License (take your pick).