Re: [Tutor] Simple factorial program

2009-06-11 Thread Emile van Sebille
On 6/11/2009 8:53 AM Eddie said... I'm trying to write a simple factorial program and am unsure at what is wrong with it. Why Can't I go *factorial = factorial * number* where factorial and number are both integers? #Factorial program print "Factorial finder" number = input("Please enter a no

Re: [Tutor] Simple factorial program

2009-06-11 Thread Dave Angel
Eddie wrote: I'm trying to write a simple factorial program and am unsure at what is wrong with it. Why Can't I go *factorial = factorial * number* where factorial and number are both integers? #Factorial program print "Factorial finder" number = input("Please enter a non-negative integer: "

Re: [Tutor] Simple factorial program

2009-06-11 Thread wesley chun
hi eddie, a few more nits to tweak... > factorialNum = 1L change to "1" instead of "1L" -- "L" numbers are going away and will be permanently not available starting in 3.0. > print "Factorial finder" > number = int(input("Please enter a non-negative integer: ")) change "input" to "raw_input".

Re: [Tutor] Simple factorial program

2009-06-11 Thread Eddie
Thanks guys, I got it working for what I need at the moment with #Factorial finder factorialNum = 1L print "Factorial finder" number = int(input("Please enter a non-negative integer: ")) for number in range(1, number): factorialNum = (factorialNum * (number + 1)) print factorialNum print "F

Re: [Tutor] Simple factorial program

2009-06-11 Thread ayyaz
Eddie wrote: I'm trying to write a simple factorial program and am unsure at what is wrong with it. Why Can't I go *factorial = factorial * number* where factorial and number are both integers? #Factorial program print "Factorial finder" number = input("Please enter a non-negative integer: "

Re: [Tutor] Simple factorial program

2009-06-11 Thread vince spicer
no ":" after for statement Vince On Thu, Jun 11, 2009 at 10:06 AM, Eddie wrote: > Thanks, that is my problem. > > With that code, why is it giving an error (indenting?) at the end of* for > number in range(number, 1) *? > > 2009/6/12 vince spicer > > did you declare factorial before trying to

Re: [Tutor] Simple factorial program

2009-06-11 Thread Eddie
Thanks, that is my problem. With that code, why is it giving an error (indenting?) at the end of* for number in range(number, 1) *? 2009/6/12 vince spicer > did you declare factorial before trying to use it? > > factorial = 1 > print "Factorial finder" > number = int(input("Please enter a non-

Re: [Tutor] Simple factorial program

2009-06-11 Thread vince spicer
did you declare factorial before trying to use it? factorial = 1 print "Factorial finder" number = int(input("Please enter a non-negative integer: ")) for number in range(number, 1) factorial = (factorial * number) print "Factorial:", factorial On Thu, Jun 11, 2009 at 9:53 AM, Eddie wrote:

[Tutor] Simple factorial program

2009-06-11 Thread Eddie
I'm trying to write a simple factorial program and am unsure at what is wrong with it. Why Can't I go *factorial = factorial * number* where factorial and number are both integers? #Factorial program print "Factorial finder" number = input("Please enter a non-negative integer: " for number in