"Byte" wrote:

> How come:
>
> sum = 1/4
> print sum
>
> returns 0?

because 1 and 4 are integer objects, so 1/4 is an integer division, which
rounds down to the nearest integer.

> 1/4=0.25, not 0. How do I fix this?

use floating point numbers:

    1.0/4.0 = 0.25

or convert one of the numbers to a float:

    float(1)/4 = 0.25

</F>



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to