[issue43034] Python tutorial misleads users about floor division behavior
Terry J. Reedy
report at bugs.python.org
Fri Jan 29 15:12:45 EST 2021
Terry J. Reedy <tjreedy at udel.edu> added the comment:
-17/3 = -5.666666666666667 = -6.0 + .333333333333333. It is the latter fraction that gets discarded.
However, this is a frequent source of confusion. How about adding
>>> -17 // 3
-6
>>> -17 % 3
1
>>> -6 * 3 + 1
-17
to illustrate what we mean, without footnote or additional text.
----------
nosy: +terry.reedy
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43034>
_______________________________________
More information about the Python-bugs-list
mailing list