<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 11/01/2013 16:35,
<a class="moz-txt-link-abbreviated" href="mailto:kwakukwatiah@gmail.com">kwakukwatiah@gmail.com</a> wrote:<br>
</div>
<blockquote cite="mid:2FB5A66FD91D456BBDFCC0AE25760392@favour"
type="cite">
<div dir="ltr">
<div style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE:
12pt">
<div>def factorial(n):</div>
<div> if n<2:</div>
<div> return 1</div>
<div> f = 1</div>
<div> while n>= 2:</div>
<div> f *= n</div>
<div> f -= 1</div>
<div> return f</div>
<div> </div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
What explanation this a function representing the math factorial.<br>
<br>
You provide a parameter n:<br>
<br>
if n est lower than 2 the factorial is 1 (return by the function).<br>
in other case you multiply previous factoriel value by n (f *= n
<=> f = f *n).<br>
And you decrement n by 1 (f -=1 <=> f = f - 1).<br>
This gives n*(n-)*(n-2).... general formula for factorial.<br>
<br>
Regards<br>
Karim<br>
</body>
</html>