Introduction to Python 3 vs Python 2 🐍🆚

Overview
Python 2 was released in 2000, Python 3 in 2008.
Python 3 is not backward compatible with Python 2.
As of January 1, 2020, Python 2 has been officially retired.

Print Function 🖨️

Python 2
print "Hello, world!"
Python 3
print("Hello, world!")
Key Difference
Python 3 requires parentheses.

Integer Division 🧮

Python 2
3 / 2 equals 1
Python 3
3 / 2 equals 1.5
Key Difference
Python 3 performs true division by default.

Unicode Support 🌍

Python 2
Strings are ASCII by default.
Unicode string with u"Hello"
Python 3
Strings are Unicode by default.
Key Difference
Enhanced Unicode support in Python 3.

Input Function 📥

Python 2
raw_input() for user input as string.
input() evaluates the input as Python code.
Python 3
input() for user input, always returns the input as a string.
Key Difference
input() in Python 3 does not evaluate the input.

Libraries and Packages 📚

Both Versions
Wide range of libraries and packages.
Python 3
More libraries are now Python 3 compatible.
Focus on Python 3 for future development.
Key Point
Transition to Python 3 for better library support.

Conclusion 🏁

Transition to Python 3
Strongly recommended for new projects.
Active development, better library compatibility.
Legacy Python 2 Code
Consider porting to Python 3 for long-term maintenance.

Resources 📖

Official Python Documentation
Python 2: https://docs.python.org/2/
Python 3: https://docs.python.org/3/