🚀 Supercharge your YouTube channel's growth with AI.
Try YTGrowAI FreePython Hello World Program

Starting with Python often means checking whether a short program can display a message. A Python Hello World program uses print() to display the text Hello World.
This article gives you the code and shows how to run it from a saved file or at the Python prompt.
TL;DR: Python Hello World
Run print(“Hello World”) in Python to write the greeting to standard output.
- Save that line in hello_world.py and run python3 hello_world.py.
- At the Python prompt, enter the same print call without the shell command.
- Both routes display Hello World.
What is a Python Hello World program?
A Python Hello World program is one short statement that sends the text Hello World to standard output. The built-in print() function writes the string argument there by default.
print("Hello World")
The quotation marks make Hello World a string, which is text treated as one value. The parentheses pass that value to print().
How to run a Python Hello World program
The interpreter can execute a saved file or accept a statement at its interactive prompt. Use the file route when you want to keep the program, and the prompt for a quick test.
Step 1: Save the program in a Python file
Create a file named hello_world.py with this one line:
print("Hello World")
The .py suffix identifies the file as Python source code. The same line was run in this file during this refresh and printed the output shown below.

Step 2: Run the file with Python
Open a terminal in the folder containing the file, then pass its name to the interpreter:
python3 hello_world.py
Hello World
The interpreter reads and runs the statements in the named file. I ran this command in the article workspace and got the output above.
Step 3: Try the same line at the Python prompt
Start the interpreter by entering python3 in a terminal. At the >>> prompt, enter the print call:
print("Hello World")
Hello World
The prompt runs the statement as soon as you press Enter. Unlike the file command, this route does not need a saved .py file.
Common errors when running Python Hello World
Check which interpreter or file is receiving the command before changing the print statement. These checks help separate a code issue from a run-target issue.
- If the terminal says the command is not found, Python may not be available under that command name. Check the official Python installation instructions for your operating system.
- If the file runs but shows different text, confirm that you saved the line in the file you are running.
- If you see >>>, you are at the Python prompt. Enter Python code there, not the shell command python3 hello_world.py.
- An IDE can run a different file than the one open in its editor. Check the selected run configuration or start the file by name from a terminal.
The Python tutorial documents that the interpreter runs interactively at a prompt and reads a script when you give it a filename. That difference explains why the command depends on where you are typing.
Conclusion
Once the output appears, change the text inside the quotes and run the file again. That keeps the first program focused on one new idea: passing a string to a function.
For the next topics, see Python data types, Python functions, and strings in Python. If Python is not available on your system, use the official Python downloads.
What is the Python Hello World code?
Use print(“Hello World”) to display the text Hello World.
How do I run a Python Hello World program?
Save print(“Hello World”) in a .py file and run it with a Python interpreter, for example python3 hello_world.py.
Can I run Hello World without saving a file?
Yes. Start the Python interpreter and enter print(“Hello World”) at its interactive prompt.


