PYTHON 2 VS PYTHON 3

All you need to know about python 3 and python 2 before you choose one of them.

HELLO WORLD

Python 2 –> print “Hello World”

Python 3 —> print(“Hello World”)

HISTORY OF PYTHON

  • Python 2.0 – October 16, 2000
  • Python 2.1 – April 17, 2001
  • Python 2.2 – December 21, 2001
  • Python 2.3 – July 29, 2003
  • Python 2.4 – November 30, 2004
  • Python 2.5 – September 19, 2006
  • Python 2.6 – October 1, 2008
  • Python 2.7 – July 3, 2010
  • Python 3.0 – December 3, 2008
  • Python 3.1 – June 27, 2009
  • Python 3.2 – February 20, 2011
  • Python 3.3 – September 29, 2012
  • Python 3.4 – March 16, 2014
  • Python 3.5 – September 13, 2015
  • Python 3.6 – October 2016
  • Python 3.7 – June 2018

KEY DIFFERENCES:

COMPARISONPYTHON 3PYTHON 2
Release Date20082000
Function printprint(“hello”)print “hello”
SyntaxsimplerDifficult
Iterationrange()xrange()
ExceptionsEnclosed in parenthesisnotations
Division of IntegersResults float valueInteger value

BUT WHAT SHOULD I CHOOSE?

When it comes to Python version 2 vs. today, Python 3 is the outright winner. That’s because Python 2 won’t be available after 2020.

Mass Python 3 adoption is the clear direction of the future. After considering declining support for Python 2 programming language and added benefits from upgrades to Python 3, it is always advisable for a new developer to select Python version 3. However, if a job demands Python 2 capabilities, that would be an only compelling reason to use this version.

Leave a comment

Design a site like this with WordPress.com
Get started