[Tutor] How can I make this run right?

Nathan Pinno falcon3166 at hotmail.com
Mon Aug 15 19:40:30 CEST 2005

I put in a 4 and expected 24, and instead got 12. It is supposed to give 4! 
not 4*3.
Early to bed,
Early to rise,
Makes a man healthy, wealthy, and wise.
--Benjamin Franklin
----- Original Message ----- 
From: "Alan G" <alan.gauld at freenet.co.uk>
To: "Nathan Pinno" <falcon3166 at hotmail.com>; "Tutor mailing list" 
<tutor at python.org>
Sent: Monday, August 15, 2005 2:20 AM
Subject: Re: [Tutor] How can I make this run right?

>> The following code is supposed to take in a number, and print number!:
>> n = int(raw_input("Number: "))
>> x = n-1
>> while 1:
>>    t = n*x
>>    while x > 1:
>>        x -= 1
>>    else:
>>        break
>> print t
>> Why isn't it working, and how can I make it print out the correct output?
> So give is a clue! What is it doing wrong? Is there an error message?
> What output did you expect? What did you get?
> Without that information we have to read the code and guess what you
> were trying to do. Then try to guess what might be different to what
> you expected.
> Alan G.

More information about the Tutor mailing list