How to Print Hello World in Python
current stable releases (Python 3.12+, Node 22, Git 2.4x) on Mac, Linux, and Windows · Last checked · Suggest an edit
https://instructions.wiki/coding/print-hello-world-in-python
Python's Hello World is one line. Here is how to run it two ways.
Check that Python is installed
Open a terminal (Terminal on Mac, Command Prompt on Windows) and run:
python3 --version
You should see something like Python 3.12.4. On Windows the command is usually python instead of python3. If neither works, install it from python.org.
Run it in the interactive shell
Type python3 and press Enter. The prompt changes to >>>. Now type:
print("Hello, World!")
Press Enter and the text prints on the next line. Type exit() to leave the shell.
Run it from a file
Create a file called hello.py containing:
print("Hello, World!")
Save it, then run it from the same folder:
python3 hello.py
The output is identical. Files are how you will run every real program, so this is the one to remember.
The most common error. If you see SyntaxError: Missing parentheses in call to 'print', you are running Python 2 syntax on Python 3. print needs parentheses in Python 3, exactly as written above.