Python : Programming Language

Introduction:

"Python is an interpreted, high-level, general purpose programming language."

Unlike, C, C++, Java or Objective C, Python programming language is interpreted programming language. By saying interpreted language, we mean, in C, C++ , Java or Objective C, we write code, compile them, execute the compiled program and then test to see whatever code we wrote works fine or not? If not then redo again - write/compile/test and redo till you achieve your goal. But in an interpreted language, source codes are not compiled, it is just translated into machine language and executed line by line, so we are able to see the results immediately without going into whole cycle of write/compile/test.

Python is very simple programming language and good for beginner to start with as it has very efficient high-level data type and huge open source libraries which helps us to write easy to understand compact code.

Python enables programmers to write readable, compact and small programs. Python programs are much shorter than equivalent C, C++, Java or Objective C programs because:

  • the high-level data types allow us to express complex operations in a single statement;
  • statement grouping is done by indentation instead of beginning and ending brackets;
  • no variable or argument declarations are necessary.

History:

Guido Van Rossum started writing an interpreter named Python [named after Monty Python, a British sketch comedy series] in December 1989 to keep himself occupied during the vacation week around Christmas. First version of Python came in 1990. While version 2.0 and version 3.0 got released in October 2000 and December 2008 respectively.

Getting Started:


Download python interpreter:

Please download the latest version of python interpreter which is suitable for your computer system (Desktop/Laptop), from Python official website - https://www.python.org/downloads/.

Installation of python interpreter:

Installing Python 3 in Windows:

After downloading the right interpreter for windows, please run the installer executable and follow the instruction. It is easy to install, just remember to check the Add Python.exe to path (See the image below)


Installing Python 3 in Linux/Ubuntu:

Most of the Linux OS comes with Python latest version as pre-installed. So if you simply want to start with Python the please try the command

$ python -V

If this command shows you the version of Python installed on your machine as latest version and you are happy to start then don't download python else download and install using command -

$ sudo apt-get install python3

Installing Python 3 in Mac OS X:

After downloading the right interpreter for Mac OSX, please run the installer executable and follow the instruction.





If you want to customise the installation then click on Customize button and do so, else click install.

Hello World Program:

Open terminal on Mac OSX / Linux machine or open DOS command prompt on windows machine and type following command -

MacOSX/Linux:

$ python
$ python3.5
For latest version 3.5, if you have older version installed with latest version.

Windows:

c:\Users\pawan> python

Now type hello world program code on python shell and press enter

>>> print ("Hello World")

You would see output as

Hello World



Congratulation, you have successfully started with Python Programming Language