On Sun, 13 Jan 2013 15:04:34 -0600, Tony the Tiger wrote:
> On Fri, 11 Jan 2013 09:35:10 -0600, kwakukwatiah wrote:
>
>>
>>
>>
>>
>> def factorial(n):
>
> Right, another html junkie, on windoze, no doubt.
X-Mailer: Microsoft Windows Live Mail 15.4.3508.1109
--
http://mail.python.org/mailm
On 11/01/13 16:35:10, kwakukwat...@gmail.com wrote:
> def factorial(n):
> if n<2:
> return 1
> f = 1
> while n>= 2:
> f *= n
> f -= 1
U think this line should have been:
n -= 1
> return f
Hope this helps,
-- HansM
--
http://mail.python.o
. 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 1
Am 11.01.2013 17:33 schrieb kwakukwat...@gmail.com:
def factorial(n):
if n<2:
return 1
f = 1
while n>= 2:
f *= n
f -= 1
return f
please it works.
I doubt this.
If you give n = 4, you run into an endless loop.
but don’t get why the ret
kwakukwat...@gmail.com writes:
> 11.01.2013 17:35, kwakukwat...@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 th
On 11/01/2013 17:33, kwakukwat...@gmail.com wrote:
-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"
-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
Le 11/01/13 16:35, kwakukwat...@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.
-
On 11/01/2013 16:35, kwakukwat...@gmail.com wrote:
def factorial(n):
if n<2:
return 1
f = 1
while n>= 2:
f *= n
f -= 1
return f
What explanation this a function representing the math factorial.
You provide a parameter n:
if n est lower than 2 the
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, kwakukwat...@gmail.com wrote:
def factorial(n):
if n<2:
return 1
f = 1
while n>= 2:
10 matches
Mail list logo