How to Write “Hello, World!” in Python

Programming languages are the building blocks of software development, allowing us to communicate with computers and create amazing applications. Python, a beginner-friendly language, is often the first choice for new programmers. In this guide, we’ll walk you through the basic steps of writing your first Python program: printing “Hello, World!” to the screen. Let’s dive right in!

Step 1: Setting Up Your Environment

Before we begin, make sure you have Python installed on your computer. You can download the latest version from the official Python website. Install it by following the installation instructions provided for your operating system.

Step 2: Opening a Text Editor

Next, open a simple text editor or an integrated development environment (IDE). Popular choices include Notepad (for Windows), Visual Studio Code, or PyCharm. You don’t need anything fancy for this task – a basic text editor will do.

Step 3: Writing the Code

Now, it’s time to write your first line of Python code. Type the following line exactly as shown:

print("Hello, World!")

This line of code uses the print() function to display the text “Hello, World!” on the screen.

Step 4: Saving the File

After writing the code, it’s crucial to save the file with the “.py” extension. For example, you could name it “”. Saving with the “.py” extension tells your computer that this is a Python script.

Step 5: Running the Program

Open your computer’s command prompt (Windows) or terminal (macOS/Linux). Navigate to the directory where you saved the “” file using the command cd (change directory). Once you’re in the correct directory, type the following command and press Enter


If everything is set up correctly, you should see the output: “Hello, World!” displayed on the screen.


Congratulations! You’ve successfully written and executed your first Python program. While printing “Hello, World!” might seem like a small step, it’s a significant milestone in your programming journey. From here, you can explore more complex concepts, build applications, and continue learning Python’s vast capabilities. Happy coding!

Leave a Comment