Hello, world! Your first script

Programming in Python usually happens in text files with the .py extension. When you run such a file, the Python interpreter reads it top to bottom, executing each statement. Let us create your first file and make the computer speak.

Create and run
Your first workflow ▶
Write
Create hello.py
Save
Write the code and save
Terminal
Open the console in that folder
Run
python3 hello.py
Walking through the code
What is inside hello.py? ▼
python
1
print('Hello, World!')
2
# This is my first comment
What makes up a statement?
Parts of a print() call
File vs output
Code vs what the user sees
Script
idname
1print('Python is cool')
Terminal
idnamestatus
101Python is coolSuccess
What the programmer sees in the editor.
In Python it does not matter whether you use single or double quotes for text, as long as the opening and closing quotes match. print("Hello") and print('Hello') behave the same.