[BangPypers] some doubts regarding python

Navin Kabra navin.kabra at gmail.com
Fri Oct 30 01:28:39 CET 2009


> Something like this should work:
> def lcm2(a, b):
>   return a*b/fractions.gcd(a,b)
>
> def lcm(mylist):
>   return reduce(lcm2, mylist)
>

Actually, this probably should be "reduce(lcm2, mylist, 1)"

navin.


More information about the BangPypers mailing list