[BangPypers] some doubts regarding python

Shashwat Anand anand.shashwat at gmail.com
Fri Oct 30 02:16:14 CET 2009


@Navin : Thanks

in case #2:
"reduce(lcm2, mylist)" works fine

On Fri, Oct 30, 2009 at 5:58 AM, Navin Kabra <navin.kabra at gmail.com> wrote:

> > 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.
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list