In article <[EMAIL PROTECTED]>,
 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> > def factorial(i):
> >    fact=1.0
> >    for n in xrange(i):
> >       fact=n*fact
> >    return fact
> 
> Simple minded indeed.
> 
> >>> factorial(3)
> 0.0
> 

Whoops, should have xrange(i)+1 there. Or, better, xrange(2,n+1). Save a 
multiplication.  Just trying to show the OP the scheme for iteration 
here.

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

Reply via email to