[Tutor] How can I let the Python Console display more decimal precision?

Lukas Nemec lu.nemec at gmail.com
Thu Jun 12 09:58:02 CEST 2014


Hi,

from the question you're using python 2.x
you can do either: 26.0/12 (float divide by int - it retypes both to 
floats and gets you 2.3333)
or at the beginning do:

from __future__ import division

That will activate python3 way of dividing - which gives you 2.3333

Lukas.

On 06/12/2014 02:48 AM, Marino David wrote:
> Hi All:
>
> I am a newbie at the Python.
>
> I type "26/12" in Python Console and get result of "2".
>
> It is obvious that the corresponding result should be 2.3333...... I 
> don't know why the Console only returns the integer part of  true 
> result. Anyone can help me out?
>
> Thanks
>
> David
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140612/09d7f34e/attachment.html>


More information about the Tutor mailing list