Python 2 and python 3 is nothing but two different versions of python. In today’s world most of the people use python 3 as it has better features. But here we’ll see the basic differences between python 2 and python 3.
In python 2 we don’t use parenthesis for printing, but we use it in python 3.
#python 2 print "Hello World" #python 3 print("Hello world")
In python 2 when you divide two numbers you will get an integer, but in python 3 you will get a float number.
# python 2 a=5 b=25 print b/a output- 5 #python 3 print(b/a) output- 5.0
The syntax of python 2 is more difficult to understand compared to python 3.
Many older libraries created for python 2 is not forward compatible. Many new libraries can only be used in python 3.
These are some few differences of python 2 and python 3.