Steven Taschuk staschuk at telusplanet.net
Tue Jun 10 17:23:01 CEST 2003

Quoth Anand Pillai:
> def fac1(x): return reduce(lambda x, y: x*y, (range(x+1))[1:])

Note that you can skip the slice by calling range appropriately:
    range(x+1)[1:] == range(1, x+1)

Steven Taschuk             "[W]e must be very careful when we give advice
staschuk at telusplanet.net    to younger people: sometimes they follow it!"
                             -- "The Humble Programmer", Edsger Dijkstra

More information about the Python-list mailing list