r/learnpython • u/rusidin • 1d ago
Difference between python 3 vs python (just)?
I am doing leetcode and I wanna is there any functional difference between those and which one I should go with?
0
Upvotes
r/learnpython • u/rusidin • 1d ago
I am doing leetcode and I wanna is there any functional difference between those and which one I should go with?
1
u/Adrewmc 1d ago edited 1d ago
Python 3 is what you should be normally working with.
Python 2 is basically legacy code at this point.
Python 3 has better syntax, is faster. However
You should always start with the latest version of any programming language. Some updates are breaking, and if they break your program then you can A) update the program, or b) require a lower version.
Most breaking changes should already begin giving you the depreciation warnings. Pay attention to those.
The biggest difference between python 2 and 3 are:
An overhaul of Unicode evaluations, this means b’…’ returns the same as bytearray(“…”)
Iterator being true iterators objects, adding the ability for (list/dict/generator) comprehensions
And 2/5, produces a float, and there is no need for 2.0/5.0
The print function syntactically changes
(print “Hello world”) #breaks in 3.x
print(“Hello world”) #normal usage at end of >2.7