Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36613
| Date | 2013-01-11 11:11 +0100 |
|---|---|
| From | Vincent Vande Vyvre <vincent.vandevyvre@swing.be> |
| Subject | Re: please i need explanation |
| References | <2FB5A66FD91D456BBDFCC0AE25760392@favour> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.392.1357899535.2939.python-list@python.org> (permalink) |
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>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: please i need explanation Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2013-01-11 11:11 +0100
csiph-web