Print Hello World in Python
PythonUse Python 3’s print() function to output text, with quick steps for scripts, the interactive shell, online IDEs, and Windows/macOS/Linux terminals.

Python 3 prints text with the built-in print()
function. Running print("Hello, World!")
confirms your environment works and teaches the basic syntax used throughout Python.
Prerequisite: Install the latest Python 3 from the official site if it’s not already on your system. See the downloads page at python.org. The print()
function is documented at docs.python.org.
Method 1: Save and run a script (recommended)
Step 1: Create a new file named hello_world.py
.
Step 2: Paste this one line into the file.
print("Hello, World!")
Step 3: Open a terminal or command prompt.
Step 4: Change directory to where you saved the file.
cd path/to/your/folder
Step 5: Run the script.
# Windows (reliable):
py hello_world.py
# Windows (if python is on PATH):
python hello_world.py
# macOS/Linux:
python3 hello_world.py
Step 6: Verify the output shows exactly one line.
Hello, World!
Method 2: Use the interactive Python shell (REPL)
Step 1: Open a terminal or command prompt.
Step 2: Start the Python REPL.
# Windows:
py -3
# macOS/Linux:
python3
Step 3: Type the print command and press Enter
.
>>> print("Hello, World!")
Hello, World!
Step 4: Exit the REPL.
exit()
Method 3: Run in a browser-based IDE (no install)
Step 1: Open any online Python IDE or notebook in your browser.
Step 2: Create a new Python file or cell.
Step 3: Enter and run the one-line program.
print("Hello, World!")
Method 4: Use IDLE (bundled with Python on Windows/macOS)
Step 1: Launch IDLE from your Start menu or Applications folder.
Step 2: Open a new file via File → New File
.
Step 3: Paste the program.
print("Hello, World!")
Step 4: Save as hello_world.py
.
Step 5: Run it with Run → Run Module
or press F5
.
Notes and quick fixes
- Use Python 3 syntax:
print()
requires parentheses in Python 3, which is the current standard. In Python 2,print
was a statement without parentheses. - Windows launcher tip: The
py
command is the official Python launcher on Windows and reliably selects your installed Python 3 (docs). Ifpython
doesn’t work, trypy
. - If nothing prints: Confirm you’re in the correct folder and you passed the filename. On Windows, run
where python
or usepy hello_world.py
. Also ensure your file is not namedpython.py
. - Strings can use single, double, or triple quotes. For example,
print('Hello, World!')
andprint("Hello, World!")
both work. - Indentation matters in Python, but not for this one-liner. When you write blocks like
if
orfor
, use four spaces per indent.
That’s all you need to print “Hello, World!” in Python. Keep the script handy—you’ll reuse the same workflow for every program you write next.
Comments