[Tutor] using the reduce function
Karl Pflästerer
sigurd at 12move.de
Fri Jan 23 16:16:55 EST 2004
On 23 Jan 2004, don arnold <- darnold02 at sprynet.com wrote:
> I may be off-base here (since I've never used reduce() before), but can't
> you just do this:
>>>> reduce(lambda x,y: max(x,len(y)),['123456','23','1234567','1'],0)
Sure you can. There are multiple solutions possible; which one you
choose may be a matter of taste and simply the fact that in that moment
I didn't thouhgt of Python having `max'. So I wrote it myself.
Karl
--
Please do *not* send copies of replies to me.
I read the list
More information about the Tutor
mailing list