> In that case you need it to use floating point numbers.
> The easiest way is to use 1.0 but if it comes from a table 
> or user entry you might have to explicitly convert:
> 
> one = 1
> other = 42
> result = float(one/other)

What Alan meant, presumably, was this:

one = 1
other = 42
result = float(one)/other

Otherwise the code simply gives 0.0 rather than 0, when we want ~0.0238.
Note that it doesn't matter which one you convert to a float, as long as one
of them is.

=Tony.Meyer

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to