funny thing about float in python

try dividing 10/100 in python. You get 0.
you can do this 1/2. You get 0. This is not an error. Python is like this.
You can refer here http://www.python.org/doc/2.2.3/whatsnew/node7.html for more details.
To rectify this you can do the following:
import __future__ import division
This will return the floating point results.

Leave a Reply

Your email address will not be published. Required fields are marked *