[Tutor] How can I make this run right?

geon geon at post.cz
Mon Aug 15 20:22:02 CEST 2005

Nathan Pinno napsal(a):

>I put in a 4 and expected 24, and instead got 12. It is supposed to give 4! 
>not 4*3.

Dear Nathan,

Everyone is giving you very good hints but seems to me you keep to 
resist :-)
Looks like you always wait for complete solution, dont you?
Here it is. There is one add and two changes. Can you see them?

n = int(raw_input("Number: "))
x = n-1
while 1:
   t = t*x
   if x > 1:
       x -= 1
print t

Its not the best solution for number!, but it is yours (and a bit of 
mine :-) )


More information about the Tutor mailing list