Python Programming Introduction

Python is a powerful high-level interpreted programming language for general-purpose programming created by Guido van Rossum and released in 1991. Initial intent for developing Python focused on code readability with syntax almost similar to human language short, clean and easily understandable.

Python is dynamically typed, the type associated with run-time values, and not named variables/fields/etc. This means programmer does not have to specify types every time, allowing programmers to write a code little quick.

Python is an object-oriented, imperative, functional and procedural programming language. It is also an object-oriented scripting language which supports automatic memory management and has a large and comprehensive standard library.

Python is an interpreted language that means every time a whole source code required to run the program while other languages like Java, C++ once compiled, its source code is not useful for running the code.

History of Python Programming Language

Python Language development started in the late 1980s and its implementation started in Dec 1982 by Guido van Rossum at CWI (Centrum Wiskunde & Informatica) in the Netherlands as a replacement to ABC capable of exception handling and interfacing with the Amoeba OS. Python got its name after BBC TV show “Monty Python’s Flying Circus”.

There are two major versions of it namely Python 2.x and Python 3.x. Both differ in some syntax and use of the functions. We’ll study their differences in the next lesson, for now, focus with Python brief intro.

Python 2.x

Python 2.0 was released on Oct 2000, with many major new features, including a cycle-detecting garbage collector for memory management, list comprehensions, support nested scopes, like other statically scoped languages, introduced with statement with 2.5 release.

Python 2.7 was the last version of 2.x series but support will continue until 2020, but users encouraged to move to Python 3 ASAP.

Python 3.x

Python 3.0 was designed to correct the design flaw but the change could not be implemented while retaining full backward compatibility with the 2.x series. This led to the development of the new version which released in Dec 2008.

Features of Python 3.0:

  • Python 3 got new features that were not supported by Python 2.x. This unsupported features can be used in Python 2 by importing a built-in module called__future__. For example, see below.
    from __future__ import division
  • Integer division: In Python 2, the division of two integers are rounded to nearest integer i.e. 10/3 = 3. And in Python 3 division gives floating point result which is similar to human calculation i.e. 10/3 = 3.333.
  • Input from Keyboard: In Python 3.x raw_input() function removed and input() used to take input from users. The function input() treats everything entered as a string, numbers are explicitly converted into integers with suffix int to input() function.
    #Python 3 
    >>> x = input('Entered input:')
    Entered input:10
    >>> x 
    >>> x=int(input("Enter:"))
    >>> x  
  • Print Function: Most wide know change in Python 3 was the print function. In 2.x print()and print both are valid while in Python 3.x parenthesis are compulsory else it will give the syntax error.
  • xrange() renamed as range() and the range() object supports slicing in Python 3.2.
  • In python 3 parenthesis mandatory to raise exception while in 2.x both with or without parenthesis is valid.
  • Moving reduce out of the built-in namespace and into functools 
  • In 3.x strings marked as Unicode(utf-8) by default and have 2 byte classes: byte and byte arrays
  • Removed backward-compatibility features

Why Python programming languages ?

  • Python is high-level language which is almost similar to English language, this make it simple, easy to learn and developer-friendly.
  • Python program works on all different platforms Windows, Mac, Linux, etc. without changing a bit from code. This make it platform independent.
  • Python is an interpreter programming language, means code gets executes line by line which debugging easy.
  • Python uses new line to complete statement where as other programming language use semicolons or parentheses.
  • Python use indentation, whitespace to define scope of variable, functions, loops and classes.
  • Programmers can write the piece of code in C, and then combine it with Python program.
  • Python’s standard library is very huge containing modules for regular expressions, documentation generation, web browsers, threading, databases, XML, XML-RPC, HTML, WAV files, unit testing, CGI, ftp, email.
  • Besides that, there are other high-quality libraries like Python Imaging Library used for image manipulation.

In the next article, you will study the difference between Python 2 and Python 3 stay tuned.

Leave a Reply

Your email address will not be published. Required fields are marked *