Table of Contents
Python is a high-level programming language which is easy to develop and integrate the systems more effectively. Python was introduced by Guido van Rossum in the year 1991. The main feature of python which distinguishes it from other programming language is its seamlessly easy syntax which is similar to the English language and the line of code is comparatively fewer than others.
Python now a days is very popular ad is used for web development, mathematics, system scripting, and software developments.
Python 2.0 was introduced in the year 2000 which introduces features like Unicode, cycle-detecting garbage collector. It will officially come to end in 2020 that means no more security patches and improvements will be released. That will automatically move the customers to Python 3.x version.
In upcoming days python 3 is wholly accepted, python 2 is legacy. Python 3.x comes with the additional features. The prime reason to use Python 3.x is it is compatible with the modern techniques like AI, data science. Powerful libraries and toolkits are introduced with this 3.x version.
Difference between Python 2.x and 3.x
|Key comparison||Python 2.x||Python 3.x|
|Print function||print “Hello”||print(“Hello”)|
|Exception||It should be enclosed in notations.||It should be enclosed in parenthesis.|
|Unicode support||By default, strings are stored as Unicode.||By default, strings are stored as ASCII, to store strings as Unicode add “u”.
|Iteration||xrange() is used for iteration||Range() is used for iteration.
|Integer division||The division of integer gives integer value.
Example: expression 5/2 will give 2 whereas 5.0/2.0 will give 2.5.
|The division of integer gives float value.
Example: expression 5/2 will give 2.5.
|Libraries||Old libraries created for Python 2 are not forward compatible. You can port 2.x library to 3.x but it will be complex.||Libraries are created strictly for Python 3.x.|