Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > please i need explanation

Reply
Thread Tools

please i need explanation

 
 
kwakukwatiah@gmail.com
Guest
Posts: n/a
 
      01-11-2013
def factorial(n):
if n<2:
return 1
f = 1
while n>= 2:
f *= n
f -= 1
return f

 
Reply With Quote
 
 
 
 
Hans Mulder
Guest
Posts: n/a
 
      01-11-2013
On 11/01/13 16:35:10, 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
 
Reply With Quote
 
 
 
 
Walter Hurry
Guest
Posts: n/a
 
      01-13-2013
On Sun, 13 Jan 2013 15:04:34 -0600, Tony the Tiger wrote:

> On Fri, 11 Jan 2013 09:35:10 -0600, kwakukwatiah wrote:
>
>> <HTML><HEAD></HEAD>
>> <BODY dir=ltr>
>> <DIV dir=ltr>
>> <DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
>> <DIV>def factorial(n):</DIV>

>
> Right, another html junkie, on windoze, no doubt.


X-Mailer: Microsoft Windows Live Mail 15.4.3508.1109

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: please i need explanation kwakukwatiah@gmail.com Python 2 01-11-2013 12:58 PM
Re: please i need explanation Karim Python 0 01-11-2013 10:41 AM
Re: please i need explanation Vincent Vande Vyvre Python 0 01-11-2013 10:11 AM
Re: please i need explanation Karim Python 0 01-11-2013 09:59 AM
Re: please i need explanation K. Elo Python 0 01-11-2013 09:56 AM



Advertisments