Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36614
| From | kwakukwatiah@gmail.com |
|---|---|
| References | <2FB5A66FD91D456BBDFCC0AE25760392@favour> <50EFE1C3.5000303@nic.fi> |
| Subject | Re: please i need explanation |
| Date | 2013-01-11 10:33 -0600 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.393.1357900426.2939.python-list@python.org> (permalink) |
-----Original Message----- From: K. Elo Sent: Friday, January 11, 2013 3:56 AM To: python-list@python.org Subject: Re: please i need explanation Hi! Since there is no stated question, I need to guess: n -= 1 (instead of "f -= 1") should work. Or maybe the question was a totally different one... -Kimmo 11.01.2013 17:35, kwakukwatiah@gmail.com wrote: > def factorial(n): > if n<2: > return 1 > f = 1 > while n>= 2: > f *= n > f -= 1 > return f > > > please it works.but don’t get why the return 1 and the code below.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: please i need explanation kwakukwatiah@gmail.com - 2013-01-11 10:33 -0600 Re: please i need explanation Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-01-11 14:20 +0200 Re: please i need explanation Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-01-11 13:58 +0100
csiph-web