Thanks guys, I got it working for what I need at the moment with <br><br><div style="margin-left: 40px;">#Factorial finder<br><br>factorialNum = 1L<br>print &quot;Factorial finder&quot;<br>number = int(input(&quot;Please enter a non-negative integer: &quot;))<br>

<br>for number in range(1, number):<br>  factorialNum = (factorialNum * (number + 1))<br>  print factorialNum<br><br>print &quot;Factorial:&quot;, factorialNum<br><br></div>On this mailing list, is there a general rule about how to place code? I.e. ident, italics, quotes???<br>

<br><div class="gmail_quote">2009/6/12 ayyaz <span dir="ltr">&lt;<a href="mailto:ayyaz84@gmail.com">ayyaz84@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Eddie wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
I&#39;m trying to write a simple factorial program and am unsure at what is wrong with it. Why Can&#39;t I go *factorial = factorial * number* where factorial and number are both integers?<br>
<br>
#Factorial program<br>
<br>
print &quot;Factorial finder&quot;<br>
number = input(&quot;Please enter a non-negative integer: &quot;<br>
    for number in range(number, 1)<br>
    factorial = (factorial * number)<br>
<br>
print &quot;Factorial:&quot;, factorial<br>
      Thanks Eddie<br>
<br>
<br></div></div>
------------------------------------------------------------------------<div class="im"><br>
<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</div></blockquote>
Hello Eddie,<br>
<br>
You never initialized the variable factorial. So the line<br>
&quot;factorial = (factorial * number)&quot; will crash your program since<br>
the program doesn&#39;t know what the variable factorial is.<br>
<br>
I would modify your code as follows:<br>
<br>
factorial  = int(raw_input(&quot;\nPlease enter a non-negative integer: &quot;))<br>
<br>
for i in range(1,factorial):<br>
    factorial *= i<br>
<br>
print &quot;Factorial:&quot;, factorial<br>
<br>
raw_input(&quot;\nPress enter to exit&quot;)<br>
<br>
<br>
I hope this helps.<br><font color="#888888">
--ayyaz</font><div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</div></div></blockquote></div><br>