[Tutor] Simple factorial program
vince spicer
vinces1979 at gmail.com
Thu Jun 11 18:08:37 CEST 2009
no ":" after for statement
Vince
On Thu, Jun 11, 2009 at 10:06 AM, Eddie <eddie9139 at gmail.com> 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 <vinces1979 at gmail.com>
>
> 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 <eddie9139 at gmail.com> 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: "
>>> for number in range(number, 1)
>>> factorial = (factorial * number)
>>>
>>> print "Factorial:", factorial
>>>
>>> Thanks Eddie [?]
>>>
>>>
>>> _______________________________________________
>>> Tutor maillist - Tutor at python.org
>>> http://mail.python.org/mailman/listinfo/tutor
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090611/d3062bbe/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 96 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20090611/d3062bbe/attachment-0001.gif>
More information about the Tutor
mailing list