22 FIRST STEPS
Your first program Hello Cedric!
Now that you’ve installed Python and IDLE, it’s
time to write your first program in Python.
Follow these steps to create a simple program
that greets the user with a cheery message.
How it works 1 Launch IDLE
A shell window appears when you start IDLE.
The program first displays the message “Hello, Ignore it and click on File in the IDLE menu.
World!” and then asks your name. Once you’ve Choose New File to create an empty editor
window where you can write your program.
typed in your name, it says hello again, but this
time it includes your name in the greeting. The
program uses something called a variable to New File
remember your name. A variable is used in Open
coding to store information.
Open Module
Recent Files
▷ Hello World flowchart
Programmers use diagrams Start Class Browser
called flowcharts to plan their
Path Browser
programs and to show how they
work. Each step is shown in a
box, with an arrow leading to
the next step. Sometimes the Say hello
steps are questions and have 2 Type the first line
In the editor window, type this line of text.
more than one arrow leading The word “print” is a Python instruction that
onward, depending on the tells the computer to display something on
answer to the question. Ask user to type the screen, such as the words “Hello, World!”
their name
print('Hello, World!')
Say hello, adding
user’s name
Hello, World!
3 Save your file
Before you can run the code, you must save
it. Go to the File menu and choose Save.
End Close
Save
Save As...