please i need explanation

Vincent Vande Vyvre vincent.vandevyvre at swing.be
Fri Jan 11 11:11:17 CET 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