On Oct 23, 1:58 pm, [EMAIL PROTECTED] wrote:
> On 22 oct, 23:39, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > Nope, still doesn't work:
>
> > def fact(x):
> >         return reduce(operator.mul,xrange(1,x+1),1)
>
> > fact() should raise an exception if x is negative.
>
> So, where is the problem? if not allowing negative numbers is so
> important for you, add a if statement and raise a ValueError exception.

indeed, especially considering that fact(x) is essentially just a
lambda statement as Marco Mariani said.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to