Doing things in one line?

Scott Anderson sanderson at ttm.com
Thu Jan 13 15:30:33 EST 2000


mwh21 at cam.ac.uk wrote:
[...]
> > reduce(lambda x, y: x + y, range(1, int(raw_input('Enter a number: ')) +
[...]
> > It accepts a number from the user and adds 1 to it. :-)
> >
> 
> No it doesn't. It computes the nth "triangular number", where n is the
> number the user enters.

My bad. Slight brain dysfunction during thought completion.  That's what
I meant to say.

Regards,

-scott




More information about the Python-list mailing list