Python 2 vs Python 3

Key differences and migration

Interview Relevant: Understanding legacy code

Python 2 vs Python 3

Python 3 is the present and future. Python 2 reached End of Life (EOL) in 2020.

Key Differences

  • Print: Statement in Py2 (print "Hi") vs Function in Py3 (print("Hi")).
  • Integer Division: 3/2 = 1 in Py2 vs 1.5 in Py3.
  • Unicode: Strings are ASCII in Py2, Unicode in Py3 by default.

AI Tutor

Ask about the topic

Sign in Required

Please sign in to use the AI tutor

Sign In