My last article was about How to set up your computer for Python Programming Language. If was easy to setup. Today we will be starting some real programming in Python. I will make you familiar with Introduction to Python Shell, structure of Python Programming Language and be printing our first Hello World program in Python Programming Language. So let’s get started.

Python Up and Running: Python Shell

Python Shell

If you have a little knowledge about Operating system, you might have heard the name, Shell. Shell in Operating system means you can open a “terminal” and interact with the operating system with the bunch of commands. But, in Python Programming language it has an entirely different meaning. In Python, the shell is used to interact with the python interpreter. You type commands in the Python Shell, and Python interpreter reads that and executes it.

To start the shell, open a terminal and type “python” at the command line. In my system, it’s like

Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.


Now we know a way to open Python Shell. But if you want GUI version of Python Shell then go to Start, type “python” and select “IDLE (Python GUI)”. You can start giving commands to the shell. But we won’t be coding in the Python shell because it gives us output in real time line by line. So, we will be using the default editor by python.

To open the editor open the shell, click on File > New File
The Editor will look –

Now this is where we will write our code.

Structure of Python Program

Now I will give you a brief introduction on its structure with our first “Hello World” Program. So, open up the editor and type this following code –

def firstProg():
    print "Hello World"

To run this program, save it and then click on “Run” and then on “Run Module”. Once you do this, Python Shell will appear with output. The Output will be “Hello World”. Now let me explain the structure of this program and how we got this output.

The first line of the Program

def firstProg():

def is defining a Function named “firstProg”. Now the second line is all about printing string “Hello World”. The interesting thing here is that we didn’t use parenthesis or curly braces to define the scope of the function. For that, we used indentation. The indentation in Python Programming language is the most important part. We use spaces (indent ) to define the scope. We also didn’t use a semicolon “;” to terminate the statement. Python is all about decreasing lines of code. The third statement –


calls the function “firstProg()” which is further printing the string “Hello World.” If you are confused by the Function part, don’t worry we’ll cover it in further articles.

Read – How to Start Blogging

Sorry if I started the basic programming from introducing the Function. But to teach you about the python indentation I have to include the function part. So this is the basic structure of Python Program.

In this course, I will assume that you have some basic knowledge of programming. If not, please visit our course Starting Programming with C. If you have any query, please feel free to comment below.

Written by Kamal Thakur