Python 2 and 3 differences
A Recent challangerecent challenge pushed me to search for differences in two major versions of pythonPython. More precisely - same code, code that returns different results in different versions. This might be helpful in other polyglot challenges.
- Strings and bytes comparissoncomparison
- Python 2:
'' == b'' - Python 3:
'' != b''
- Rounding (Luis Mendo answer)
- Python 2:
round(1*0.5) = 1.0 - Python 3:
round(1*0.5) = 0
- Division (Jonathan Allan answer)
- Python 2:
10/11 = 0 - Python 3:
10/11 = 0.9090909090909091
- Suggestions?