We use cookies. More

How to Write a Basic Hello World Script in Python

In this tutorial, we will say hello to world from our Python command shell.

Advertisement

We will write a very simple Hello World script in Python as a start. If you didn't already install Python, please check this tutorial that will help you with the installation.

1. Our first step is to open Python command shell. There are several ways to open Python command shell and we will demonstrate each of them below:

1.a) On the start menu, type python in the search box and click Python (command line) on the Programs list.

How to Write a Basic Hello World Script in Python - 1

1.b) Go to Python installation path, and double click on python.exe.

How to Write a Basic Hello World Script in Python - 2

1.c) Open command line window by typing cmd in the start menu search box and pressing Enter when cmd.exe is selected.

How to Write a Basic Hello World Script in Python - 3

In the command line, type python and press enter. Note that, if you have not added python installation path to the system Path, you have to write full path of python.exe.

How to Write a Basic Hello World Script in Python - 4

2. Once the Python command shell is open, type

print ("Hello World!")

and press enter. Python command shell will display Hello World! in a new line.

How to Write a Basic Hello World Script in Python - 5
Advertisement

Was this post helpful?

If you found this post to be helpful, please share it! Thank you :)

f t g+ in