Iteration for Factorials

Py-Fun lorna.burns at gmail.com
Mon Oct 22 08:54:36 EDT 2007


On 22 Oct, 13:43, 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.

Marco, Thanks for the tip.  This now works:

def itforfact(n):
    while n<100:
        print n
        n = n+1
n = input("Please enter a number below 100")

itforfact(n)

Is it a "factorial" though?




More information about the Python-list mailing list