Introduction to Python

What is Python?

Python is a widely used high-level programming language for general-purpose programming, created by Guido Van Rossum and first released in 1991. An interpreted language, Python has a design philosophy which emphasizes code readability (notably using whitespace indentation to delimit code blocks rather than curly brackets or keywords), and a syntax which allows programmers to express concepts in fewer lines of code than might be used in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale.


We assume that you have:

  • Basic understanding of what computer does and what computer programs do
  • Knowledge of C Language
  • Knowledge of Object Oriented Concepts like Objects,Classes,Inheritance,Polymorphism, etc.
  • Knowledge of any Object Oriented Language like C++,Java or C#

These Software must be installed to follow the Language tutorial. - Python 3 (Download from Python Website or apt install it ) - IPython 3 (An interactive Python Shell, Download from IPython Project Site or apt install it)

We will be using several libraries throughout the tutorial. They can be installed with pip (or pip3) as pip install <library-name>. Following is a list of libraries that has to be installed to follow the tutorial. - matplotlib (For visualizing data sets) - numpy (For faster array operations) - seaborn (For enhancing matplotlib graphs, automatically installs scipy1 and pandas) - networkx (Provides Graph Data Structure)

1 Installation of scipy via pip may fail in Windows. Follow this guide to make it work

Your First Program

As a tradition, we start with a program to display Hello World on the Console Screen (or the stdout)

Open the Interative Python Shell by typing ipython(or ipython3) from the terminal. If everything goes well, you will get a prompt where you can enter statements and see the effect of it. Now enter the following statement to get started

In [1]:
print("Hello World")
Hello World

Congrats! You have successfully executed your first statement in python. In fact there are many ways to execute python statements. Interactive Console is one of them. You can also pack the statements into single file, whose name ends with an extension .py, you can call python (or python3) to execute them. We will also check this method to execute python statements. Save the contents of below cell into a file named

Run this command to execute the file


In [2]:
print("Hello World")
print("Hi from Python File")
Hello World
Hi from Python File

Note: The usage of print() function is

  • sep is the seperator string to be printed in between values in list_of_values
  • end is the terminating string that has to be printed after list_of_values


In [40]: