Anagram

Jason Orendorff jason at jorendorff.com
Wed Jan 23 11:04:49 EST 2002


> What's wrong with
> 
>     from operator import __mul__
>     def f(s): return reduce(__mul__, range(1,len(s)+1), 1)

Actually the Lisp friend might like:

  f = lambda s: reduce(lambda x,y:x*y+x, range(len(s)), 1)

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list