Python is among the most popular programming languages in the world today. While most may attribute its popularity to its applications in fields such as Data Science and Machine Learning, it is also well-liked by beginners due to the ease of learning its syntax.

As a high-level programming language, Python’s syntax is closer to human lingo than it is to machine code. Not only does this make programming more intuitive, but it also helps you get started with relatively less difficulty.

With that in mind, it’s time to kickstart your Python journey with your very first “Hello, World” program!

What Is “Hello, World”?

"Hello, World" is a simple text program that generally serves as a practical introduction to the basic workings of a programming language.

Almost every programmer, regardless of the language they’re learning, starts with the very same programming task---printing “Hello, World” on the terminal or output screen.

In some cases, owing to its simplicity, “Hello, World” is also used to pre-test or debug new features in a programming environment. After all, if you think about it, even though the program itself is quite rudimentary, the fact that it executes successfully would mean that everything behind the scenes is probably working as it should be.

Interestingly, another area where “Hello, World” is used is in the evaluation of a programming language or API’s ease-of-learning. Given that most programmers start their programming journey with it, the time taken for a beginner to write their very first program is used as a measure of how easy it is to get started with a certain language or API.

Also known as ‘Time to Hello, World’ or TTHW, this measure plays a crucial role in the user-centric design process of most modern programming features today.

But, why does everyone use “Hello, World” specifically and not “Hey, World” or “Hiya, World”?

The Legacy of “Hello, World”

Of course, there is no hard-and-fast rule that restricts you from using a grammatical variation of “Hello, World”. That said, over the past several decades, “Hello, World” has grown to become a time-honored tradition.

Brian Kernighan, one of the most-read programming authors of all time, first referenced ‘Hello, World’ in his book “C Programming Language”. Over the years, as his legendary book became a bible of sorts for budding computer scientists, the “Hello, World” program gradually became synonymous with beginning one’s coding journey.

Today, you get to be a part of this long-standing legacy.

Installing Python

Of course, the first step is to get Python set up on your computer. For this tutorial, we will be using the latest version, Python 3.

Head over to Python’s downloads page, look for the most recent version of Python 3 and download the installer suitable for your operating system.

Once it's downloaded, click on the installer and follow the steps shown on the screen to install Python 3 on your PC. This also gives you access to pip and IDLE.

For this tutorial, we will be using IDLE, or Integrated Development and Learning Environment, which is Python’s default IDE.

Related: How to Run a Python Script

Writing Your Very First Python Program

Once Python 3 is installed on your PC, look for IDLE in your file directory and open it. You will be greeted with the IDLE Shell as shown here. This is where the output of your code is displayed.

While you can simply type a command in the shell to print “Hello, World”, we will be creating a new file to do so. Since more complex programs rely on a source code file for their execution, it's good practice to run even the simplest programs using a source code file.

On your shell, click on File > New File, as shown here. This opens an IDLE editor window where you can type code, which is then executed in the shell.

Open a new IDLE Editor in Python

Before writing anything, save your file as helloworld.py. Now, onto the part that you’ve been waiting for.

To display anything on a python shell, we use an inbuilt function called print(). As the name suggests, this function ‘prints’ a value on the screen every time it's called. To print a particular value, we pass it as an argument in the print() function.

To do so, type the following code:

            print(“Hello, World”) 
    

In Python and most other programming languages, a string is written within double quotation marks.

Now, save your program again and run it. To run your program, select Run > Run Module in the top menu.

running a python script

Congratulations! You have successfully coded and run your very first program in Python 3! Your output should look something like this -

Hello World Output

Related: Why Python Is the Programming Language of the Future

Continuing Your Coding Journey

Now that you have started on your coding journey with the iconic Hello, World program, there’s a lot more left to explore.

You can try running the same program on different IDEs available in the market, or perhaps try programming a more challenging variation of helloworld.py. One such variation can be printing every letter on a separate line (Hint: one way to do this is by using a for loop).

Going further, you can even check out some online resources to learn more about the functionality and usability of Python 3.