On 25/11/05, Nick Lunt <[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > >>> def f(x, y):
> > ...  return x*y
> > ...
> > >>> arr = range(1, 10)    # Don't want to include 0!
> > >>> reduce(f, arr)           # Our target
> > 362880
> > >>> tmp = [1]
> > >>> [f(x, y) for x in arr for y in [tmp[-1]] if tmp.append(f(x,
> > y)) or True][-1]
> > 362880
> > >>> print 'Magic!'
> > Magic!
>
> LOL I feel like I've accidentally signed up for the perl-tutor list ;)

Oh no --- I have become that which I hate!

I must quickly go and do twenty 'import this's as penance for my sins...

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

Reply via email to