On Sun, 30 Nov 2008 03:42:50 +0000, Steven D'Aprano wrote:

> def lcm(a, b):
>     return a/gcd(a, b)*b
> 
> (By the way: there's a subtle bug in lcm() that will hit you in Python 
3. Can you spot it?

Er, ignore this. Division in Python 3 only returns a float if the 
remainder is non-zero, and when dividing by the gcd the remainder should 
always be zero.

> Here's a hint: your unit tests should also assert that 
> the result of lcm is always an int.)

Still good advise.



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

Reply via email to