Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36613 > unrolled thread

Re: please i need explanation

Started byVincent Vande Vyvre <vincent.vandevyvre@swing.be>
First post2013-01-11 11:11 +0100
Last post2013-01-11 11:11 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: please i need explanation Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2013-01-11 11:11 +0100

#36613 — Re: please i need explanation

FromVincent Vande Vyvre <vincent.vandevyvre@swing.be>
Date2013-01-11 11:11 +0100
SubjectRe: please i need explanation
Message-ID<mailman.392.1357899535.2939.python-list@python.org>
Le 11/01/13 16:35, kwakukwatiah@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>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web