contact@eeehub.in +919470012104

Python2 and Python3

We will be seeing the difference between Python2 and Python3. We know that Python3 is not developed on top of python3. So, some features that was present in the python2 was deprecated in latest version.


Python2:


  1. Parenthesis () was not mandatory with the print function in python2.
  2. Python2 has two input version input() and raw_input().
  3. Integer division in python2 view give rounded the nearest integer. If you divide 3/2. It will give 1 in pthon2.
  4. There are two functions range() and xrange() which returns list and an object respectively.

Python3:


  1. Parenthesis () is mandatory in print function.
  2. There is only one input() function to take input from keyboard.
  3. Integer division in python3 will give as per result. If you divide 3/2. It will give 1.5 in pthon3 which is more intuitive for new programmer.
  4. In python3, xrange() function of python2 is rename as range().