How on Factorial

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Mon Nov 1 03:20:42 EDT 2010


In message <dvukp7-7sa.ln1 at satorlaser.homedns.org>, Ulrich Eckhardt wrote:

> Geobird wrote:
>
>> def fact(x):
>>     return x > 1 and x * fact(x - 1) or 1
> 
> I'd say this is about as small as it gets.

    fact = lambda x : x > 1 and x * fact(x - 1) or 1

-- 
Lawrence “Functionalism Strikes Again” D’Oliveiro



More information about the Python-list mailing list