DEV Community

Cover image for 1.1 Python-2 vs Python-3
Mohit Raj
Mohit Raj

Posted on • Updated on

1.1 Python-2 vs Python-3

In this Complete series we are going to learn python 3.
You people think that why Python 3 . so i am going to tell you you why python3 in place of python2
# Important difference between Python2.x and Python3.x
1.Division operator
2.print function
3.Unicode
4.xrange
5.Error Handling

Alt Text

1. Division operator

   If we are porting our code or executing the python 3.x code in python 2.x, 

it can be dangerous if integer division changes go unnoticed (since it doesn’t raise any error). I will discuss about the operators in upcoming parts

2. print function

 In python2 print function is replaced by print() function.  

3. Unicode

    In Python 2, implicit str type is ASCII. But in Python 3.x implicit str type is Unicode.

4. xrange

     xrange() of Python 2.x doesn’t exist in Python 3.x. In python3  range() function is implemented

5. Error Handling

   There is a small change in error handling in both versions. In python 3.x, ‘as’ keyword is required.

Python3 have so many in-builts library which makes its use easier on industry lebel,web developers and daily by daily python3 evaluated
to a new level.

next part:

If you have any problem use the comment box and ask me what you want related to the topic
Thank You...

Top comments (0)