Python - Hello World Program


python logo

In this tutorial we will write our first Hello World Python program.

Lets go ahead and write the "Hello World" program using text editor like Sublime Text and then we will use PyCharm IDE.

Feel free to use any other text editor of your choice.

Using text editor

Lets begin our journey by printing "Hello World" text using Python.

Create a new file by the name and then write the following code inside.

print("Hello World")

We don't have to put semicolon ; at the end of the line in Python like we do in other programming langauages like C and Java.

Now, open the Terminal (for Mac and Linux) and type the following command.

$ python

For Windows, assuming you have Python executable installed on your C:, run a similar command in the Command Prompt.


Where, pythonXX is the Python version you have installed on your machine.

If there was no error then you will get to see the "Hello World" text on your screen.

python hello world program

Using PyCharm IDE

In the following example we will be using PyCharm Community Edition IDE to write and run our "Hello World" Python program.

Step #1: Create New Project

When you open the IDE you will see the following. Select the first option 'Create New Project'.

pycharm community edition - create new project

Or, if you are already in a project then click on File then select New Project.

pycharm community edition - create new project

Step #2: New Project

Set the location of your project on your computer and select the base interpreter.

In the following example I have named my project HelloWorld and selected Python 3.7.

pycharm community edition - name the project

Step #3: Create a new Python file

Now right click on the project folder HelloWorld, then select New and then click on Python File.

pycharm community edition - new python file

Now, name the file HelloWorld and click on the OK button.

pycharm community edition - new python file name

This will create a new Python file inside the project folder.

Step #4: Write the "Hello World" program in Python

Inside the file write the following code.

print("Hello World")

Step #5: Run "Hello World" program

Save your program and click on Run and then click on Run 'HelloWorld'.

pycharm community edition - run hello world program

This will open the in-built Run console of PyCharm IDE and you will get to see the output "Hello World".

pycharm community edition - run hello world program output

And this brings us to the end of this tutorial. In the next tutorial we will dive deep into Python programming langauge.

If you find this tutorial and this website interesting and helpful then do share it on social media with your friends.

See you in the next tutorial. Have fun programming.