[Tutor] a quetion on "There should be one and preferabley oneobvious way to do it"

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 22 Jan 2002 14:32:01 -0800 (PST)


On Mon, 21 Jan 2002, Anton Sherwood wrote:

> > ###
> > >>> cube = lambda x: square(square(x))
> > >>> cube(42)
> > 3111696
> > ###
> > 
> > is weird as heck.  *grin*
> 
> Of course we all know that the above-defined function is quartic,
> cube is really lambda x: x*square(x), and 42^3 = 74088.  So I won't
> waste everyone's time by mentioning it.


You're right!  *slap on forehead*  Thank you for catching me on that.  
That's another good reason why Tutor is so wonderful --- we can catch each
other's slipups.  *grin*


I was being way too hasty when I was typing that.  The correct code should
have been:

###
cube = lambda x: square(x) * x
###

Thanks again!