please i need explanation

Vincent Vande Vyvre vincent.vandevyvre at swing.be
Fri Jan 11 05:11:17 EST 2013


Le 11/01/13 16:35, kwakukwatiah at gmail.com a écrit :
> def factorial(n):
>     if n<2:
>              return 1
>     f = 1
>     while n>= 2:
>         f *= n
>         f -= 1
>     return f
>  
>
>
I guess you mean:
    f = 1
    while n>= 2:
        f *= n
        n -= 1
    return f

Try it.



-- 
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>



More information about the Python-list mailing list