Decimals in python

Aidan aweraw at
Mon Jun 16 08:24:16 CEST 2008

arslanburney at wrote:
> Hello. New to using Python. Python automatically round off watver i
> calculate using the floor function. How wud i make the exact value
> appear?
> Tried out fabs() in the math library but still confused. Cud some1
> elaborate on it.

If you're working with integers, the result will always be an integer:

 >>> a = 10/3
 >>> print a

How ever if you add a float into the mix:

 >>> a = 10/3.0
 >>> print a


More information about the Python-list mailing list