Run your first Python program
Quick review (2 minutes)
A program is a list of instructions that a computer carries out in order.
Lines you want to keep go in the editor window. A line you want to try once goes after >>> in the Shell. Save the file, choose Run and then Run Module, and read the result in the Shell below the newest RESTART line. For print("Lantern") the printed line is Lantern. The quote marks belong to your instruction, and the >>> belongs to the Shell, so neither is part of the printed line.
Open IDLE from your Python 3.13 installation. IDLE is an optional part of Python. If it is missing, look for instructions from whoever provided your Python. Depending on its settings and how you start it, IDLE may open an editor window when it starts. If you do not see the Shell, choose Run, then Python Shell, to open it.
In the Shell, after the
>>>prompt, typeprint("Lantern")and press Return. The Shell shows Lantern.Choose File, then New File, to open an empty editor window.
In the editor window, type
print("Lantern")on line 1. Type the instruction only, without>>>.Choose File, then Save. A new file has no name yet, so IDLE asks you for one with Save As. Type lantern.py. While a window has unsaved changes, its title has a * at each end. The title bar also shows the Python version, so check that it says 3.13.
Choose Run, then Run Module. The IDLE documentation names F5 as the key for it. If you forgot to save, IDLE either asks you to save or saves for you, depending on its settings.
Look at the Shell. You see a line containing RESTART, then Lantern, then the prompt.
In the editor, change Lantern to Cove so the line reads
print("Cove"). Save, then run again. Cove appears below a newer RESTART line. Lantern stays higher up, because the Shell keeps earlier output.
The usual mistake is writing the expected output as >>> Lantern, or as Lantern inside quote marks. The >>> is the Shell's prompt. The Shell shows it after the run to say it is ready for your next line, so it is not part of what your program printed. The quote marks belong to your instruction, and the printed line is Lantern alone. A related slip is copying >>> into the editor window. The file holds only your instruction. If nothing new appears, check two things. Look in the Shell, because the result never appears in the editor. Then look at the window title, because a * at each end means your latest change is not saved yet.
1 In plain words
A program is a list of instructions that a computer carries out in order. Python is a language for writing those instructions. Think of asking a friend to buy bread. You can say it out loud once, or you can write it on a note they can read again tomorrow. Python works both ways. You can try one instruction right now, or you can keep instructions in a file and run that file whenever you like.
You will use IDLE, Python's Integrated Development and Learning Environment, for both. IDLE has two main kinds of window: the Shell and the editor. The Shell is where you try one instruction at a time and where results appear. When it waits for you, it shows >>>, a mark called the prompt. An editor window is where you write instructions into a file and save them. IDLE treats a file whose name ends in .py, such as lantern.py, as Python code. The title bar is the strip across the top of a window, and in an editor it shows the file's name.
A few more words before you start. An instruction is also called a statement. To run a file means to tell Python to carry out every statement in it. In IDLE's menus a Python file is called a module, so Run Module means "run the file in this editor window". Output is whatever the program shows you when it runs.
Your first instruction is print("Lantern"). Read it aloud as "print the text Lantern". The word print names the instruction. The round brackets hold what it should print. The quote marks show where the text starts and stops. A piece of text in quote marks is called a string. Remember three things: the Shell is for trying one line now, the editor is for keeping lines in a file, and the output appears in the Shell either way. To look something up later, read the Run menu part of the IDLE documentation, which explains Run Module.
2 Picture it
In the editor, lantern.py contains print("Lantern"). Run Module sends the program to Python. In the Shell, Lantern appears between the restart notice and the next prompt.
3 Why
When you press Return in the Shell, it runs the one-line statement you typed. When you choose Run Module from an editor window, IDLE checks the file and, if it finds no error, restarts the Shell and then runs the file. The output is displayed in the Shell window, and it appears only when the program asks for it, for example with print. The restart shows up as a line containing the word RESTART.
The print instruction writes the text you give it and then ends the line. When you do not tell it where to write, it writes to a place called standard output. IDLE connects standard output to the Shell's display area, which is why the result appears there and not in the editor. When the run is complete, the Shell shows a prompt again so you can keep going.
4 The rule
Lines you want to keep go in the editor window.
A line you want to try once goes after >>> in the Shell. Save the file, choose Run and then Run Module, and read the result in the Shell below the newest RESTART line. For print("Lantern") the printed line is Lantern. The quote marks belong to your instruction, and the >>> belongs to the Shell, so neither is part of the printed line.
5 How
- Open IDLE from your Python 3.13 installation. IDLE is an optional part of Python. If it is missing, look for instructions from whoever provided your Python. Depending on its settings and how you start it, IDLE may open an editor window when it starts. If you do not see the Shell, choose Run, then Python Shell, to open it.
- In the Shell, after the
>>>prompt, typeprint("Lantern")and press Return. The Shell shows Lantern. - Choose File, then New File, to open an empty editor window.
- In the editor window, type
print("Lantern")on line 1. Type the instruction only, without>>>. - Choose File, then Save. A new file has no name yet, so IDLE asks you for one with Save As. Type lantern.py. While a window has unsaved changes, its title has a * at each end. The title bar also shows the Python version, so check that it says 3.13.
- Choose Run, then Run Module. The IDLE documentation names F5 as the key for it. If you forgot to save, IDLE either asks you to save or saves for you, depending on its settings.
- Look at the Shell. You see a line containing RESTART, then Lantern, then the prompt.
- In the editor, change Lantern to Cove so the line reads
print("Cove"). Save, then run again. Cove appears below a newer RESTART line. Lantern stays higher up, because the Shell keeps earlier output.
6 Worked example
Run the saved file
print("Lantern")
Standard input
Empty
Standard output
Lantern
Save the line in lantern.py. Choose Run Module in the editor, then look in the Shell for the printed line.
Edit and run again
print("Cove")
Standard input
Empty
Standard output
Cove
Change the text in the editor, save and run the file again. The Shell shows Cove on its own line.
7 The trap
The usual mistake is writing the expected output as >>> Lantern, or as Lantern inside quote marks. The >>> is the Shell's prompt. The Shell shows it after the run to say it is ready for your next line, so it is not part of what your program printed. The quote marks belong to your instruction, and the printed line is Lantern alone. A related slip is copying >>> into the editor window. The file holds only your instruction. If nothing new appears, check two things. Look in the Shell, because the result never appears in the editor. Then look at the window title, because a * at each end means your latest change is not saved yet.
Quick checks
Quick check 1 of 2
A new file tide.py contains one line, print("Tide pool"). You save it and choose Run, then Run Module. Write the exact line the Shell displays as output.
Show the steps and the answer
Tide pool
Why: print writes the text and then ends the line. The quote marks belong to the instruction, and the >>> shown afterwards is the Shell prompt, not output.
Source: Python Software Foundation, Built-in Functions: print() (Python 3.13 documentation)
Quick check 2 of 2
You ran lantern.py with Run Module. In which window do you look for Lantern, and what kind of line comes just before it?
Show the steps and the answer
The Shell window. Just before the output is a line containing RESTART.
Why: Run Module restarts the Shell, then runs the file and shows its output in the Shell window, not in the editor.
Source: Python Software Foundation, IDLE: Python editor and shell (Python 3.13 documentation)
Sources
- IDLE: Python editor and shell (Python 3.13 documentation). Python Software Foundation. PSF License Version 2. Read 25 Nov 2026.
- Built-in Functions: print() (Python 3.13 documentation). Python Software Foundation. PSF License Version 2. Read 25 Nov 2026.