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@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to