Python Hello World Example

In this example, we will show you a Python Hello World example.

1. Introduction

Python is an easy-to-learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.

The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python website,, and may be freely distributed. The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications.

2. Example

This is a very simple explanation of writing a Hello World example in Python so I am not going to use any complex structure here. I will make use of Visual Studio Code to write the code. Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. You can download it from here.

First you need to make sure that you have got Python installed. You can check this by typing python --version on the terminal. The good thing about VS Code is that you get an in-build Terminal as well, so you don’t need to start a separate Terminal application. To start the Terminal on VS Code go to View -> Terminal

Figure 1. Terminal

Once you click on the Terminal VS Code will open a new terminal window. Type python –version to check the version of Python installed on your machine:

~$ python --version
Python 3.9.9
Figure 2. Python version

Let us now create a new file and call it The file will contain one line as below:

print('Hello World')

To run the code you can click on the right arrow on the top right corner. You willl see that Hello World gets printed on the Terminal.

3. Interactive mode

When commands are read from a tty, the interpreter is said to be in interactive mode. In this mode it prompts for the next command with the primary prompt, usually three greater-than signs (>>>); for continuation lines it prompts with the secondary prompt, by default three dots (...). The interpreter prints a welcome message stating its version number and a copyright notice before printing the first prompt:

~$ python
Python 3.9.9 (main, Nov 21 2021, 03:23:44) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Now you can type the same thing you did in the file above:

>>> print('Hello World')
Hello World

As you can see that ‘Hello World’ gets printed on the next line.

4. Summary

In this example we learned how to write a very simple Hello World example in Python. First we briefly looked at Python programming language. There is a lot to this language which you can learnr from it’s documentation. In the next section we discussed how to use VS Code to constuct the example code. VS Code is very easy-to-use tool for writing codes – there are a lot of other features as well but this is not the right place to discuss it. In the end we also looked how to use the interactinge programming feature of Python.

Mohammad Meraj Zia

Senior Java Developer
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
2 years ago

But We want real life example with coding

Back to top button