How to find N facorial using a For loop?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5136447/function-for-factorial-in-python">Function for Factorial in Python</a>  </p>
</blockquote>



<p>I need to write a program in python that returns N!, without using the factorial function. I have a program written so far but I keep getting an error saying, <code>local variable "fact" is assigned but never used</code>. How do I use <code>fact = 1</code>, after it is assigned?</p>

<pre><code>from pylab import *  


def factorial(n):
    fact = 1

for i in range(n):
    print("i = ", i)
    fact = fact * i

print("The factorial of " + str(n) + " is: " + str(fact))
</code></pre>
