Are you confused between the two? These are two different paths altogether. This article talks about the difference between the two.[vc_row][vc_column][vc_column_text]
First Thing First
Every computer language that graduates to a new version – is an improvement over its previous version, and in most of the cases that improvement is backward-compatible. Being backward-compatible means code written in previous versions still works when compiled with new version of the same computer language. Python is a different case – Python 2.x and 3.x are not at all compatible to one another.
[/vc_column_text][vc_separator color=”chino” style=”double” el_width=”90″][vc_column_text css=”.vc_custom_1532623694157{padding-top: 5px !important;padding-right: 5px !important;padding-bottom: 5px !important;padding-left: 5px !important;background-color: #daf7a6 !important;border-radius: 5px !important;}”]
News for you!!!
Python 2.0 was first released in the year 2000, and its latest version 2.7 was released in 2008. It has been officially announced that python 2.7 won’t be maintained after 2020.
[/vc_column_text][vc_column_text]There is a lot of work that has been done using Python 2.x. There exists large amount of libraries and tons of Python 2.x code along with huge community that supports python 2.x – perhaps larger than Python 3.x – still python 2.x has to go, clock is ticking.
Differences between Python 2.x and Python 3.x
There are significant difference between the two versions. Till the time both existed simultaneously, it was OK to know one and not the other, but know one must know the differences between the two so that existing code can be migrated from python 2.x to python 3.x.
[/vc_column_text][vc_column_text]1. Python 3.x first released in the year 2008 with stable version 3.6 released in 2016 is now the future. 3.7 has also been released in June 2018.
2. Experienced Python 2.x programmers will have to migrate, while new programmers should start with 3.x only, there is no need to learn 2.x first.
3. Python 2.x and Python 3.x have their own libraries which not compatible with each other.
4. Python 3.x is an improvement over Python 2.x. It makes best use of UNICODE standard which is a superset of ASCII.
5. Print Statement has a different syntax in Python 2.x and Python 3.x and can’t be used interchangeably.
Python 2.x – print statement:
print "Hello! my dear"
Python 3.x – print statement
print ("Hello!! My dear")
6. Python 3.x employs better integer division method.
Python 2.x – Integer Division
var x=5 var y=2 print x/y
will give the output: 2 and not 2.5
You will have to explicitly give command as follows to get the output 2.5
var x=5.0 var y=2.0 print x/y
In case of Python 3.x – Integer Division
var x=5 var y=2 print(x/y)
will produce 2.5[/vc_column_text][vc_column_text]
Conclusion – At the End
There are lot more differences between the two, I have not listed all them here in this article. No doubt, Python 3.x is the future. Since Python 2.x is going to fade away by 2020 (earlier it was supposed to be 2018) , very soon you will have no support left for the same.
Python 3.7 is the current version at the time this article is being published, released in June 2018. It is futuristic and comes with lots of improvements over 2.x legacy. So I advise to all my students and readers to start with 3.x if you are Python beginner and if you are experienced programmer you will need to upgrade yourself to 3.x.[/vc_column_text][/vc_column][/vc_row]