[docs] [issue30361] Docs example: converting mixed types to floating point
Mihai Borobocea
report at bugs.python.org
Sun May 14 05:08:39 EDT 2017
New submission from Mihai Borobocea:
Section 3.1.1 in the Docs states:
"operators with mixed type operands convert the integer operand to floating point"
https://docs.python.org/3/tutorial/introduction.html
But gives an example using the division operator:
>>> 3 * 3.75 / 1.5
7.5
>>> 7.0 / 2
3.5
In Python 3, division always returns a float, e.g. when all operands are integers:
>>> 3 * 3 / 1
9.0
>>> 7 / 2
3.5
To illustrate that "operators with mixed type operands convert the integer operand to floating point" the example should not use division. For example:
>>> 3 * 3.75 - 1
10.25
>>> 7.0 + 2
9.0
----------
assignee: docs at python
components: Documentation
messages: 293641
nosy: MihaiHimself, docs at python
priority: normal
severity: normal
status: open
title: Docs example: converting mixed types to floating point
versions: Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30361>
_______________________________________
More information about the docs
mailing list