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@python
components: Documentation
messages: 293641
nosy: MihaiHimself, docs@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue30361>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to