On Jul 21, 10:21 pm, Alexandru Palade <[EMAIL PROTECTED]> wrote: > > Another thing, you could have just added a dot after the constant in > order to promote the expression to be evaluated as float. As in > percentage = bytes_transferred / /self/.__sessions[path].total_bytes > * 100. > (notice the last dot) >
True, you get a float result, but not a very useful one: >>> a = 2 >>> b = 11 >>> a / b * 100 # OP's problem 0 >>> a / b * 100. # Your suggestion; same as (a / b) *100. 0.0 >>> a * 100 / b # Fredrik's suggestion 18 >>> a * 100. / b # What you probably meant 18.181818181818183 >>> -- http://mail.python.org/mailman/listinfo/python-list