Iteration for Factorials

cokofreedom at gmail.com cokofreedom at gmail.com
Mon Oct 22 14:58:48 CEST 2007


On Oct 22, 2:43 pm, Marco Mariani <ma... at sferacarta.com> wrote:
> Py-Fun wrote:
> > def itforfact(n):
> >     while n<100:
> >         print n
> >         n+1
> > n = input("Please enter a number below 100")
>
> You function should probably return something. After that, you can see
> what happens with the result you get.

lambda n: n<=0 or reduce(lambda a,b: long(a)*long(b),xrange(1,n+1))





More information about the Python-list mailing list