Every programming journey starts the same way: we write a tiny program, run it successfully, and prove to ourselves that our setup works. In Python, that first win is usually Hello, World!. It may look simple, but this one exercise teaches us the real workflow we’ll use again and again—create a file, write code, save it, and run it from the terminal.
In this tutorial, we’ll create a Python file named hello.py, write our first line of code, add a comment, and execute the program correctly.
We will create a small script that prints a message in the terminal:
Hello, World!This might feel small, but it’s the foundation. Once we can run a file confidently, we can start building larger programs the same way.
We only need two things: a text editor to write the file and a terminal/command prompt to run it. A text editor is different from a word processor—our editor should save plain text and highlight code.
If we don’t have an editor yet, we should choose one and stick with it while learning. Any of these work well:

Create a new file and name it exactly:
hello.pyThe .py extension tells our computer (and us) that this file contains Python code. Keeping file names simple is a good habit early on, because it reduces mistakes when we run the file from the terminal.
Open hello.py in our editor so we can start typing.
Inside hello.py, write this single line:
print('Hello, World!')This line uses Python’s built-in print() function. The job of print() is straightforward: it takes the value we provide and displays it in the terminal.
The part inside quotes—'Hello, World!'—is a string, which is just a fancy word for text. The quotes matter because they tell Python: “treat this as text, not as a command.” Without quotes, Python would assume we’re referring to a variable name or something else.
Python allows both single quotes ('...') and double quotes ("...") for strings. For now, we should pick one style and be consistent. In this example, we’re using single quotes.
Now leave a little space and add a comment under our print statement:
# print hello, world! to the terminalA comment is a note written for humans. Python ignores comments completely when it runs our program. Comments are useful when we want to explain what a section does, leave reminders, or make our code easier to understand when we revisit it later.
The key rule is simple: **a comment begins with **“.
Save hello.py in our editor. This is an easy step to forget in the beginning, and it’s the most common reason we might run an old version of our code.
A good habit is: after every change, hit save before switching to the terminal.
We have two ways to run our program:
hello.py is open and selected.python hello.py in the terminal.
hello.py using the cd command:cd \Users\Admin\Desktop\Python Exercises>cd \Users\Admin\Desktop\Python Exercises> python hello.pyor
python3 hello.pyCode language: CSS (css)
Most terminals support Tab auto-complete. Start typing a folder name, press Tab, and the terminal will try to complete it for us. This is not just faster—it prevents spelling mistakes.
When run correctly, we’ll see:
Hello, World!
Our file is executed top-to-bottom by Python. It reads the first line, sees the print() call, and displays the message.

Beginners often mix up these two actions:
python alone starts an interactive Python prompt (we can type commands one by one).python hello.py runs our file as a complete program.For building scripts and real projects, we will mostly run files.
hello.py fileprint('Hello, World!')
# print hello, world! to the terminalIf our output didn’t appear, it’s usually one of these simple issues:
cd and make sure hello.py is there.