"Byte" wrote:

> That dosnt work either:
>
> sum = 0.1+1/4
> print sum
>
> Just returns 0.1

division has higher precedence than addition, so 1/4 is calculated first,
and the result is then added to 0.1.

and as I've already explained, 1/4 is an integer division, so the result
is rounded down to the the nearest integer (0).  in other words, your
expression boils down to

    0.1 + 0

which is 0.1 [1].

the precedence order is explained here:

    http://docs.python.org/ref/summary.html

</F>

1) or at least a close approximation of it; see
    http://docs.python.org/tut/node16.html



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

Reply via email to