Module 1 · Downloading and Installing Python · Lesson 3 of 4
Create your very first program
Tradition says your first program should say hello to the world — so let's honour it. Open a text editor, type one line, and save it as a file called hello.py. The .py ending tells everyone (and your computer) that it's Python.
Write it, save it, run it
hello.py
1print("Hello, World!")
Terminal
$ python hello.py
Hello, World!
Then run it from a terminal with python hello.py. Python reads your file top to bottom, hits the print instruction, and writes Hello, World! back to you. That's a complete program — really.
It looks tiny, but you just did the whole loop of programming: you wrote an instruction, saved it, and the computer carried it out. Every program you ever write — however large — is built from exactly this. Now let's see what happens when it goes wrong.