Consider this expression 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6
.
DuckDuckGo evaluates it to 6.75
(as does Google).
Python 2 evaluates it to 7:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6
7
>>> ^D
Python 3 evaluates it to 6.75:
$ python3
Python 3.4.0 (default, Apr 9 2014, 11:51:10)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print(3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6)
6.75
>>>`enter code here`
Why does Python 2 evaluate to 7 and Python 3 evaluate to 6.75?
How does Python arrive at the result?