print
is a statement, while in Python 3, it’s a function.a = 3
In Python 3, dividing two integers will return a float:
Output: b = 3.3333333333333335
This behavior in Python 3 is more consistent and intuitive.u
prefix. For example:
In Python 3, Unicode is the default encoding for all strings, making it easier to work with international text, emojis, and symbols:range()
and xrange()
. range()
would return a list, while xrange()
would return an iterator (which is more memory efficient).In Python 3, range()
behaves like xrange()
did in Python 2. It returns an iterator instead of a list, making it more memory-efficient.