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

2014-07-01 Thread James Chapman
You could just initialise your variables with float() float(26)/float(12) 2.1665 varA = float(26) varB = float(12) varA/varB 2.1665 And so on... In fact, you only need to initialise one variable with float for this to work: varA = float(26) varB = 12 varA/varB

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

2014-06-12 Thread Marino David
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... I don't know why the Console only returns the integer part of true result. Anyone can help me out? Thanks David

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

2014-06-12 Thread Lukas Nemec
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.) or at the beginning do: from __future__ import division That will activate python3 way of dividing - which gives you 2. Lukas. On 06/12/2014

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

2014-06-12 Thread Steven D'Aprano
On Thu, Jun 12, 2014 at 08:48:25AM +0800, 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... I don't know why the Console only returns the integer part of true